Re: limited types (Was: Records that could be arrays)
- From: "Randy Brukardt" <randy@xxxxxxxxxxxxxx>
- Date: Fri, 24 Feb 2006 15:57:46 -0600
"Thierry Bernier" <email@xxxxxxxx> wrote in message
news:Xns9774B59B784EFemailenonmoc@xxxxxxxxxxxxxxxx
Stephen Leake <stephe_on_the_web@xxxxxxxxxxxx> wrote :field must be
If we implemented points as limited private types, we wouldn't be
Please do not.limited is like the flu : a record containing a limited
limited itself.
For example, you can not extend a Gtk.Window.Gtk_Window_Type with an
extension containing a limited type, or else the root of these types must
be limited (and I don't own it).
limited should be used only when the type is really limited (when using
accesses, tasks, etc).
Disagrees ?
Limited is a flu, as you put it, but it is a pretty mild flu. Indeed, in Ada
200Y, it pretty much means that you can't assign it, and that's it. You can
have aggregates and functions with suitable limitations.
Indeed, many of us think that "limited" should be the default for Ada. (It
certainly ought to be for interfaces and tagged types, because that allows
more uses.) Only if you *need* assignment should something be non-limited.
For example, your window example *should* be limited; it doesn't make sense
to assign windows. (Yes, Claw does this wrong, too, mainly because of the
limitations on the use of limited in Ada 95 that no longer apply.) That's
especially valuable because then the extensions can include any kind of
component.
Of course, you often do need assignment. The containers are non-limited so
that they can be composed. And that's because it doesn't make sense to have
limited elements (as the elements have to be copied into the container).
But in any case this is decision that needs to be made based on the use of
the type, not for philosophical reasons...
Randy.
.
- Follow-Ups:
- Re: limited types (Was: Records that could be arrays)
- From: Dmitry A. Kazakov
- Re: limited types (Was: Records that could be arrays)
- From: Matthew Heaney
- Re: limited types (Was: Records that could be arrays)
- References:
- limited types (Was: Records that could be arrays)
- From: Thierry Bernier
- limited types (Was: Records that could be arrays)
- Prev by Date: Re: accessing record element (question to the pros)
- Next by Date: Re: Quick question about Ada code formatting.
- Previous by thread: limited types (Was: Records that could be arrays)
- Next by thread: Re: limited types (Was: Records that could be arrays)
- Index(es):