From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f0be8eebb2993001 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada 2012 : aliased parameters ? Date: Tue, 29 Mar 2011 19:12:43 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <8adad214-6381-4296-9097-878fbb517f6e@k7g2000yqj.googlegroups.com> <87lizxiy6c.fsf@mid.deneb.enyo.de> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1301443978 12612 69.95.181.76 (30 Mar 2011 00:12:58 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 30 Mar 2011 00:12:58 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Xref: g2news2.google.com comp.lang.ada:19565 Date: 2011-03-29T19:12:43-05:00 List-Id: "Florian Weimer" 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.