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: g2news1.google.com!news3.google.com!feeder.news-service.com!feeder.erje.net!news.szaf.org!news.gnuher.de!news.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: Ada 2012 : aliased parameters ? Date: Sat, 23 Apr 2011 20:47:16 +0200 Message-ID: <87aafgerez.fsf@mid.deneb.enyo.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ruchba.enyo.de 1303584436 10046 172.17.135.6 (23 Apr 2011 18:47:16 GMT) X-Complaints-To: news@enyo.de Cancel-Lock: sha1:AlvATZfnpX5CwtTEDi7dlBpkKxw= Xref: g2news1.google.com comp.lang.ada:19022 Date: 2011-04-23T20:47:16+02:00 List-Id: * Randy Brukardt: > The motivating case is to make the containers better. Ada 2012 adds the > following to all of the containers: > > function Reference (Container : aliased in out Vector; Position : in > Cursor) > return Reference_Type; > > where Reference_Type is defined as: > > type Reference_Type (Element : not null access Element_Type) is private > with > Implicit_Dereference => Element; Is it necessary that Element is a discriminant? If the aliased business works with fields, you could write something like this: type String_Reference is record Data : access String; end record; function "+" (S: aliased String) return String_Reference is begin return String_Reference'(Data => S'Access); end "+"; String_Reference could be part of an array, so we would get ragged arrays as a side effect. In any case, it seems to me that the definition of "master" in 7.6.1 needs updating.