From: mheaney@ni.net (Matthew Heaney)
Subject: Re: limited/non-limited in Ada95
Date: 1997/10/18
Date: 1997-10-18T00:00:00+00:00 [thread overview]
Message-ID: <mheaney-ya023680001810971145040001@news.ni.net> (raw)
In-Reply-To: ufhgaghueo.fsf@synquiry.com
In article <ufhgaghueo.fsf@synquiry.com>, Jon S Anthony <jsa@synquiry.com>
wrote:
>mheaney@ni.net (Matthew Heaney) writes:
>
>> What "important capabilities" do limited types have? That they're passed
>> by reference? You get that for free anyway for tagged types, even if the
>> tagged type is non-limited.
>
>Well, they are _not_ necessarily passed by reference. That is part of
>what Henry Baker is (correctly) whinging about.
>
>The most important part is that they can't be implicitly aliased -
>especially via assignment.
I don't understand Henry's problem. If I implement a bank account as
package Bank_Accounts is
type Bank_Account is limited private;
...
private
type Bank_Account is
limited record
Money : Dollars := 0.0;
end record;
end;
Then what's the problem? Always implement the full view as a limited
record. (My only complaint is that you can't apply the limited qualifier
to other types, not even arrays. Bummer. So you have to wrap the type in
a limited record. Oh well.)
I agree that aliasing can comprimise the safely of a limited type (everyone
ought to read Baker's Limited Robbery paper), but if the programmer always
implements a limited private type by using a full view that is itself
limited - which one can do in Ada 95 - then there is no problem.
<ftp://ftp.netcom.com/pub/hb/hbaker/LimitedRobbery.ps.Z>
<ftp://ftp.netcom.com/pub/hb/hbaker/LimitedRobbery.html>
If the programmer doesn't use a by-reference type, then it's a case of
programmer indolence, not a language problem.
All the same, it would be really swell if compilers would tell you when you
implement a limited private type using a type that isn't passed by
reference. It would be cool too if that were added as an argument to
pragma Restrictions, something like
Full_View_Of_Limited_Private_Must_Be_Limited.
--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271
next prev parent reply other threads:[~1997-10-18 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 [this message]
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-23 0:00 ` Jon S Anthony
1997-10-24 0:00 ` Geert Bosch
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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox