comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Ensuring postconditions in the face of exceptions
Date: Tue, 16 Mar 2010 11:18:24 -0400
Date: 2010-03-16T11:18:24-04:00	[thread overview]
Message-ID: <wcciq8wxpkv.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: hnmt1l$phn$1@munin.nbi.dk

"Randy Brukardt" <randy@rrsoftware.com> writes:

> "Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message 
> news:wcc7hpgckyy.fsf@shell01.TheWorld.com...
>> "Randy Brukardt" <randy@rrsoftware.com> writes:
>>
>>> For the record, I think you mean "limited record types". There are no
>>> requirements on how limited private types or record types that happen to 
>>> be
>>> limited because of a limited component are passed.
>>
>> Well, that needs some clarification:  for example, a record containing
>> a task is passed by reference, even if the record doesn't explicitly
>> say "limited".
>>
>> The point is, the compiler looks at the full types of everything
>> involved when deciding whether it must pass something by reference.
>> So "limited private" is irrelevant.
>
> I missed a word: I meant "explicitly limited record type" (that is one that 
> contains the word "limited" in the record declaration). That and "tagged" 
> are the only ways to *guarantee* that a record is passed by reference.

That's still not quite right.  A record that contains a task, protected,
or a tagged component is passed by ref, even if the record
is not explicitly limited.

See RM-6.2.

> Jeff Carter writes:
>>Really? ARM 6.2 seems to me to say that any limited type (a type whose full 
>>view
>>is limited) is passed by reference. This explicitly includes a composite 
>>type
>>with a component of a limited type.

...with a component of a by-ref type.

> You suddenly added "full view" to this, and that's the crux of the problem: 
> "limited" is a property of a view, while "by-reference" is a property of a 
> type. (BTW, 6.2(7) is subtly broken, see AI05-0096-1 for details if you're 
> Adam or want to know every possible detail. :-) The point is that there are 
> many limited types that are not required to be passed by reference, 
> including some record types that are limited.

Right.  Example: record containing a component of a limited private
type, whose full type is scalar.

> Also note that your statement here is also subtly wrong: a record type has 
> to be passed by reference if it has a by-reference component -- not a 
> limited component! A component of a limited private type would make the 
> record limited but not necessarily by-reference (read the rules carefully 
> again).
>
> Repeat after me: "limited" is a property of a view! It's not constant for a 
> particular type! That's a common mistake that even those of us on the ARG 
> make from time-to-time.

I don't understand why the definition of "by reference" is subtly
different from the definition of "immutably limited".

- Bob



  reply	other threads:[~2010-03-16 15:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12  9:13 Ensuring postconditions in the face of exceptions Ludovic Brenta
2010-03-12  9:24 ` Ludovic Brenta
2010-03-12  9:29 ` Niklas Holsti
2010-03-12 11:08   ` Ludovic Brenta
2010-03-12 14:00     ` Jeffrey R. Carter
2010-03-13  3:15       ` Randy Brukardt
2010-03-13 15:14         ` Robert A Duff
2010-03-16  3:13           ` Randy Brukardt
2010-03-16 15:18             ` Robert A Duff [this message]
2010-03-16 19:00               ` Adam Beneschan
2010-03-16 20:04                 ` Robert A Duff
2010-03-16 23:23               ` Randy Brukardt
2010-03-13 17:34         ` Jeffrey R. Carter
2010-03-13  7:54 ` Stephen Leake
     [not found] ` <ruqub2y84rqj.179q01lxzgatj$.dlg@40tude.net>
2010-03-13 19:33   ` Georg Bauhaus
2010-03-14 14:05 ` Alex Mentis
2010-03-14 14:21   ` Ludovic Brenta
2010-03-14 15:12     ` Alex Mentis
2010-03-15  9:14       ` Ludovic Brenta
2010-03-15 11:05         ` cjpsimon
2010-03-15 13:04           ` Ludovic Brenta
2010-03-15 14:16             ` J-P. Rosen
2010-03-15 19:14         ` Jeffrey R. Carter
2010-03-16 19:25           ` Robert Matthews
2010-03-14 15:38     ` Robert A Duff
2010-03-15  8:54       ` Ludovic Brenta
2010-03-15 16:44         ` Robert A Duff
2010-03-15 17:33           ` Ludovic Brenta
2010-03-15 18:36             ` Robert A Duff
2010-03-14 18:57     ` Jeffrey R. Carter
2010-03-15  8:56       ` Ludovic Brenta
2010-03-15 11:04 ` AdaMagica
replies disabled

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