comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Ada 2012: In-out parameters for functions
Date: Sun, 05 May 2013 21:45:52 +0200
Date: 2013-05-05T21:45:52+02:00	[thread overview]
Message-ID: <op.wwmmiqtcule2fv@cardamome> (raw)
In-Reply-To: CDAC1492.2D8D2%yaldnif.w@blueyonder.co.uk

Le Sun, 05 May 2013 14:52:18 +0200, Bill Findlay  
<yaldnif.w@blueyonder.co.uk> a écrit:
>> Seems this topic was not discussed at all for Ada 2012.
>
> I'm glad to hear it, because the idea is bonkers.
>
> Declarations collect relevant info to one easily found place in the code,
> instead of having it splattered around at random.
>
> These suggestions about parameter mode make no more sense than suggesting
> that, instead of declaring:
>
>   I : Integer; S ; String;
>
> One should instead have to write things like:
>
>    I% := I% + 1;
>    S$ := "";
>
> (A la BASIC)

Rational for Ada 2022 says:
> We wanted to help the users to tracks variable dependencies
> and side effects on variables. The declaration and thus the
> type of a variables is typically not very far and most of
> times, local (or when not that close, that's typically a
> constant defined in a specification, and a constant is less
> cause of errors than a variable). Function declarations are
> on the opposite, typically far away and not local, so it's
> easier to lose track of sub‑program signatures than lose track
> of variable types. Thus, Ada 2022 added some syntax to allow
> users to express there intended effects in a way which allow the
> compiler to catch any erroneous assumptions.

I fully agree with the Rational for Ada 2022.

Then, there is nothing bad in helping catching errors and unintended  
behaviours.

Personally my option for a syntax would be something like with SML (SML  
being the de‑facto standard to me, at avoiding unwanted side‑effects):


     -- Declaration:

     procedure P
       (A, B :    out The_Type;
        C, D : in out The_Type;
        E, F : in     The_Type);

     -- Use case:

     (A, B, C, D) := P (C, D, E, F);


What appears on the LHS would be what's “out” or “in out” and what appears  
on the RHS would be what's “in” or “in out”, with what's “in out”  
appearing both on the LHS and RHS.

But I have no hope for it to be ever accepted, as the call‑place syntax  
would surely be too much far from typical Ada syntax, and may be too few  
people are used to this kind of syntax.


-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University



  parent reply	other threads:[~2013-05-05 19:45 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01 16:28 Ada 2012: In-out parameters for functions dptrash
2013-05-01 17:27 ` Shark8
2013-05-01 19:04 ` Yannick Duchêne (Hibou57)
2013-05-01 19:37   ` Dmitry A. Kazakov
2013-05-01 19:58     ` Yannick Duchêne (Hibou57)
2013-05-02  6:41       ` Dmitry A. Kazakov
2013-05-02  7:11         ` Yannick Duchêne (Hibou57)
2013-05-01 23:37 ` Peter C. Chapin
2013-05-03 10:48 ` anon
2013-05-03 11:04   ` Simon Clubley
2013-05-03 11:32   ` Simon Wright
2013-05-03 11:42   ` Yannick Duchêne (Hibou57)
2013-05-03 11:54     ` Yannick Duchêne (Hibou57)
2013-05-03 23:29       ` Randy Brukardt
2013-05-04  1:02         ` Adam Beneschan
2013-05-05  5:16           ` Randy Brukardt
2013-05-05 10:24         ` Niklas Holsti
2013-05-05 11:11           ` Yannick Duchêne (Hibou57)
2013-05-05 12:52             ` Bill Findlay
2013-05-05 15:09               ` Niklas Holsti
2013-05-05 19:23                 ` Yannick Duchêne (Hibou57)
2013-05-05 20:37                   ` Niklas Holsti
2013-05-07  0:30                 ` Randy Brukardt
2013-05-07  2:36                   ` Yannick Duchêne (Hibou57)
2013-05-05 19:45               ` Yannick Duchêne (Hibou57) [this message]
2013-05-06 15:40               ` Adam Beneschan
2013-05-06 16:17                 ` Bill Findlay
2013-05-06 16:47                   ` Adam Beneschan
2013-05-06 18:43                     ` Bill Findlay
2013-05-07  0:07                     ` Dennis Lee Bieber
2013-05-07  2:34                       ` Yannick Duchêne (Hibou57)
2013-05-07  0:26             ` Randy Brukardt
2013-05-06 15:26           ` Adam Beneschan
2013-05-07  0:36             ` Randy Brukardt
2013-05-07  3:59           ` Yannick Duchêne (Hibou57)
2013-05-07  4:13             ` Yannick Duchêne (Hibou57)
2013-05-07 11:52             ` Yannick Duchêne (Hibou57)
2013-05-03 11:45   ` AdaMagica
2013-05-03 23:54     ` Randy Brukardt
2013-05-04  6:58       ` J-P. Rosen
2013-05-04  7:21         ` Dmitry A. Kazakov
2013-05-04 17:58           ` J-P. Rosen
2013-05-04  7:40         ` Yannick Duchêne (Hibou57)
2013-05-04  8:05           ` Simon Wright
2013-05-04 17:55           ` J-P. Rosen
2013-05-04  0:40   ` Keith Thompson
replies disabled

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