comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: limited/non-limited in Ada95
Date: 1997/10/21
Date: 1997-10-21T00:00:00+00:00	[thread overview]
Message-ID: <EIFAAn.5o2@world.std.com> (raw)
In-Reply-To: mheaney-ya023680001610972221540001@news.ni.net


In article <mheaney-ya023680001610972221540001@news.ni.net>,
Matthew Heaney <mheaney@ni.net> wrote:
>What "important capabilities" do limited types have? ...

The important capability of limited types is that you can't do
assignment.  Maybe you don't call that a "capability", but I think it
is.  Perhaps the right way to put it is: the programmer (of some
abstraction) has the capability to document the fact that no assignments
will happen on this type.  And one can trust that documentation, since
the compiler verifies it (as opposed to comments).

It's like asking, "What capability do constants have?"  After all,
variables are just like constants, but can do more things (like have
their value change).  So what's the point of constants?  Mainly, the
point is that the reader of the code knows "this thing won't change".
(There's also an efficiency point -- the compiler can take advantage of
the fact that so-and-so won't change.)

One could view "constant" as a restriction (you can't say "X := 3;") but
I think it's just the opposite -- the Ada 'constant' feature allows the
programmer to express something useful.  There's no restriction -- if
you want to change it, just say so (ie just don't make it a constant).

Likewise, for limitedness.  The fact that you can't assign to a limited
thing is not a restriction, but, on the contrary, allows the programmer
to express an interesting fact.  If you *want* to assign to it, fine,
don't make it limited.

- Bob




      parent reply	other threads:[~1997-10-21  0:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-13  0:00 limited/non-limited in Ada95 Tom Moran
1997-10-16  0:00 ` Matthew Heaney
1997-10-17  0:00   ` Jon S Anthony
1997-10-18  0:00     ` Matthew Heaney
1997-10-21  0:00       ` Jon S Anthony
1997-10-21  0:00         ` Robert A Duff
1997-10-22  0:00           ` Jon S Anthony
1997-10-23  0:00             ` Fergus Henderson
1997-10-23  0:00               ` Jon S Anthony
1997-10-24  0:00                 ` Geert Bosch
1997-10-23  0:00               ` Jon S Anthony
1997-10-22  0:00           ` Robert Dewar
1997-10-22  0:00             ` Jon S Anthony
1997-10-21  0:00         ` Robert Dewar
1997-10-21  0:00           ` Jon S Anthony
1997-10-22  0:00             ` Robert Dewar
1997-10-22  0:00               ` Jon S Anthony
1997-10-18  0:00     ` Tom Moran
1997-10-18  0:00       ` Matthew Heaney
1997-10-19  0:00         ` Tom Moran
1997-10-19  0:00           ` Matthew Heaney
1997-10-21  0:00             ` Tom Moran
1997-10-21  0:00               ` Matthew Heaney
1997-10-21  0:00         ` Robert A Duff
1997-10-21  0:00   ` Robert A Duff [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox