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: a07f3367d7,65b902127ca8a604 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!oleane.net!oleane!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Issue with GNAT GPL 2009 and GtkAda Date: Mon, 29 Jun 2009 16:59:40 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <4A414EBB.8060204@free.fr> <1avd65rn49abv$.krcxo2gdzb16$.dlg@40tude.net> <10ym4hltpwd4n$.1hcayfi4xidg3.dlg@40tude.net> <4a44842e$0$31872$9b4e6d93@newsspool3.arcor-online.net> <1hi0km5xe1802.17l3qjn1g9525$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1246312822 13006 69.95.181.76 (29 Jun 2009 22:00:22 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 29 Jun 2009 22:00:22 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Original Xref: g2news2.google.com comp.lang.ada:6736 Date: 2009-06-29T16:59:40-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:u7txi934iaog$.gw40yhq8811x.dlg@40tude.net... > On Fri, 26 Jun 2009 16:38:45 -0500, Randy Brukardt wrote: ... >> We're also planning on adding a way to force by-reference parameter >> passing. >> The motivating use is for the containers, but I'm sure it will find other >> uses as well. > > This makes no sense to me. It is another mistake of making after C++. > There > is no reason why by-reference must be enforced anywhere if not required by > the type. If you need "return by-reference" (however that is described), you need to pass the objects involved by-reference. >> As far as the use of class-wide components, I think that would be easily >> fixed by just allowing them. > > That would make objects non-contiguous. It is not obvious to me how that > will work with streams and pools. I prefer a more transparent model when > all components of a constrained object are constrained. Well, Ada has always allowed non-continguous objects. There is no problem with streams: the stream attributes take care of any non-contiguous parts. As for pools, multiple calls to Allocate are allowed; again there is no requirement that the objects are contiguous. (That's been confirmed by AI05-0107-1, but it has always been true for Ada 95; there are plenty of AARM notes making that clear). >> That would reduce the need to use access types some more. (But it can >> never >> be completely eliminated; sometimes you really do need reference >> semantics, >> especially for returns.) > > No, this is the mental trap. If something requires by-reference semantics > that is not a return. Considering containers: > > A (I) := X; > > It is a semantic mistake to treat A (I) as a function "returning" > something. This can only lead to introducing more and more strange > constructs like limited aggregates, return statements and other mess. > > A (I) := X; > > must be treated as a syntax sugar for a procedure call > > Put (A, I, X); That works for full object assignment, but not in any sane way for in-place component updating. And full object assignment really doesn't need any special syntax (Replace_Element works just fine); the problem is when you need to update a single element of a container which is itself an element. It doesn't make sense to try to think of these sorts of operations as a single procedure. Randy.