comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada 2012 : aliased parameters ?
Date: Tue, 29 Mar 2011 19:12:43 -0500
Date: 2011-03-29T19:12:43-05:00	[thread overview]
Message-ID: <imtsia$ca4$1@munin.nbi.dk> (raw)
In-Reply-To: 87lizxiy6c.fsf@mid.deneb.enyo.de

"Florian Weimer" <fw@deneb.enyo.de> wrote in message 
news:87lizxiy6c.fsf@mid.deneb.enyo.de...
>* AdaMagica:
>
>> Aliased parameters are meant to cure a deficiency in e.g. containers.
>> With current Ada, it's awkward to replace an element of a container.
>>
>> Now if you make the curser an aliased parameter, the function result
>> may dereference safely the cursor, since the cursor and the result are
>> tightly coupled,
>
> But this is already the case in Ada 2005.  The lifetime of passed-in
> objects extends beyond the immediate need for evaluating the
> expression:
>
> | Leaving an execution happens immediately after its completion,
> | except in the case of a _master_: the execution of a body other than
> | a package_body; the execution of a statement; or the evaluation of
> | an expression, function_call, or range that is not part of an
> | enclosing expression, function_call, range, or simple_statement
> | other than a simple_return_statement.

This works in your example because you avoid the type system completely and 
thus the accessibility checks. It also would work if you don't care that it 
can raise Program_Error if someone passes in a local variable. That runtime 
source of failure is not acceptable, and the use of alised parameters makes 
it a compile-time check.

                                     Randy.





  parent reply	other threads:[~2011-03-30  0:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28 11:47 Ada 2012 : aliased parameters ? Yannick Duchêne (Hibou57)
2011-03-28 11:56 ` Dmitry A. Kazakov
2011-03-29  3:04   ` Randy Brukardt
2011-03-28 11:56 ` AdaMagica
2011-03-29 18:22   ` Florian Weimer
2011-03-29 18:34     ` Shark8
2011-03-29 19:35       ` Florian Weimer
2011-03-30  0:12     ` Randy Brukardt [this message]
2011-03-29  3:16 ` Randy Brukardt
2011-03-29  7:34   ` Maciej Sobczak
2011-03-30  0:09     ` Randy Brukardt
2011-03-30 19:44       ` Randy Brukardt
2011-04-23 18:47   ` Florian Weimer
2011-04-25  7:19     ` Randy Brukardt
2011-04-28 19:47       ` Florian Weimer
2011-04-28 23:54         ` Randy Brukardt
2011-04-30 18:32           ` Florian Weimer
2011-04-30 23:46             ` Randy Brukardt
replies disabled

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