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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,3867e2f73fa21ec X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 X-Received: by 10.66.14.165 with SMTP id q5mr4280128pac.47.1367582093265; Fri, 03 May 2013 04:54:53 -0700 (PDT) Path: bp1ni1451pbd.1!nntp.google.com!news.glorb.com!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Ada 2012: In-out parameters for functions Date: Fri, 03 May 2013 13:54:51 +0200 Organization: Ada @ Home Message-ID: References: <7704abab-86f2-4edc-ad4b-b3d4e70004fb@googlegroups.com> NNTP-Posting-Host: nReaOVWq/ugo3wZUL0F24Q.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.15 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2013-05-03T13:54:51+02:00 List-Id: Le Fri, 03 May 2013 13:42:02 +0200, Yannick Duch=C3=AAne (Hibou57) = a =C3=A9crit: > However, I personally still miss the ability to remind in/in=E2=80=91o= ut/out = > modes at the call=E2=80=91place, and that's the main grief I have with= Ada on = > that topic. While there is a syntactical tip to get part of this, with the argument = = surrounded in parentheses: function Plus_Plus_Ada (E : in out Integer) return Integer; -- Don't laugh, that's not `Ada_Plus_Plus` :D function Plus_Plus_Ada (E : in out Integer) return Integer is begin E :=3D E + 1; return E; end; -- =E2=80=A6 Two sample use=E2=80=91cases -- This will pass compilation: declare I : Integer :=3D 0; begin I :=3D Plus_Plus_Ada (I); end; -- This will not pass compilation, -- and will give you an error about -- `I` which must be a variable: declare I : Integer :=3D 0; begin I :=3D Plus_Plus_Ada ((I)); end; But that's a bit like the `non null` for access type, which should have = = been the default. Would be better if to have to explicitly says you know= = the argument may be modified, instead of explicitly say you expect it to= = not be modified and add parentheses everywhere. -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity