comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Gnat 2013 is out!
Date: Wed, 19 Jun 2013 16:57:45 -0500
Date: 2013-06-19T16:57:45-05:00	[thread overview]
Message-ID: <kpt9gq$vdp$1@loke.gir.dk> (raw)
In-Reply-To: 51b6c424$0$6633$9b4e6d93@newsspool2.arcor-online.net

"Georg Bauhaus" <rm.dash-bauhaus@futureapps.de> wrote in message 
news:51b6c424$0$6633$9b4e6d93@newsspool2.arcor-online.net...
...
> Second, concerning the constraints that need to be supplied,
> is there *any* way in Ada that allows them to be stated
> "really simply"?

If you need constraints, that is not an appropriate use of this feature. 
It's really for discarding error codes from non-Ada APIs, and those should 
be some discrete type (either integer or enumeration). The base type is good 
enough for those cases.

It would be usable for some composites, but not all. But that's OK, the 
entire point is to have a simple shorthand for a discarded parameter. If it 
gets at all complex, it no longer has much benefit in readability (I'd much 
rather see an explicit declaration rather than some strange magic syntax). 
And discarding of composite parameters is slightly suspicious.

> If the dummy syntax is for expressions of substitutes of a regular
> declaration, how can a dummy expression be so much more simple
> than a dummy declaration?

The syntax I proposed was "<>". That's it, there is no declaration, 
constraint, range, or any of that. It's readable, can easily be read to mean 
"discard" in this case, and it doesn't look much like a legal parameter 
expression.

If it gets much more complex than that, then it simply isn't worth it. 
Compare what I write today:

   declare
        Dummy : Code_Type; -- Not used in the following
   begin
        Some_Call (Param_A, Param_B, Dummy);
   end;

That's 5 lines, 8 extra tokens for the Dummy declaration. That's a very 
small amount of writing to save, so whatever replaces it had better be very 
small or there is no point:

        Some_Call (Param_A, Param_B, <>);

qualifies. The more complex suggestions I have seen simply don't simplify 
enough to justify the complexity.

> About the only thing I can imagine towards simplified syntax
> is inference of type *and* range constraints, with the help
> of context (the subprograms' declarations). Is that double
> inference part of Ada right now?

There is (or should be) no need to constraints on dummy temporaries that are 
going to be discarded anyway. Why would anyone want something discarded to 
be range checked (thus introducing a point of failure)? If you need that, 
that's *not* a discarded dummy.

Since you don't *want* constraints on dummies, there is no need to infer 
them. Just use the base type of the parameter, and be done with it. If there 
is any ambiguity, or you can't have an object of the base type, then you'll 
have to write those 8 extra tokens. How awful. :-)

But I think you've convinced me this feature isn't worth the work. It just 
doesn't save enough, and the slippery slope of people trying to expand it 
(so it saves nothing in either dimension) completely kills any value. And 
that's before anyone does a detailed semantic analysis on it, which often 
kills apparently good ideas anyway.

                                               Randy.


  reply	other threads:[~2013-06-19 21:57 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29 13:36 Gnat 2013 is out! J-P. Rosen
2013-05-29 15:03 ` Simon Wright
2013-05-29 16:13   ` Simon Wright
2013-05-29 22:39     ` Randy Brukardt
2013-05-30  2:01       ` Adam Beneschan
2013-05-30  8:01         ` Bill Findlay
2013-05-30 23:09           ` Dennis Lee Bieber
2013-05-31  5:02             ` J-P. Rosen
2013-05-31 18:35             ` Bill Findlay
2013-05-30 10:39         ` Simon Wright
2013-05-30 16:21           ` Adam Beneschan
2013-05-30 19:53         ` Randy Brukardt
2013-05-31  7:41           ` Dmitry A. Kazakov
2013-05-31 11:30           ` Stefan.Lucks
2013-05-31 12:03             ` Niklas Holsti
2013-05-31 22:07             ` Randy Brukardt
2013-06-01 11:51               ` Georg Bauhaus
2013-06-03 14:52                 ` Adam Beneschan
2013-06-04 17:42                   ` Wesley Pan
2013-06-04 18:34                     ` Adam Beneschan
2013-06-04 19:00                       ` Wesley Pan
2013-06-05 15:40                     ` Eryndlia Mavourneen
2013-06-11  2:39                   ` Randy Brukardt
2013-06-11  6:31                     ` Georg Bauhaus
2013-06-19 21:57                       ` Randy Brukardt [this message]
2013-05-30  0:31 ` Dennis Lee Bieber
2013-05-31 16:12 ` dptrash
2013-06-01  5:10   ` Stephen Leake
2013-06-01  6:00   ` Per Sandberg
2013-06-01  6:46   ` J-P. Rosen
2013-06-01 15:22     ` Bill Findlay
2013-08-27 14:08   ` Yannick Duchêne (Hibou57)
2013-08-27 20:05     ` wilson
2013-08-27 22:59       ` Dennis Lee Bieber
2013-08-28  7:35         ` Dmitry A. Kazakov
2013-08-28 23:39           ` Dennis Lee Bieber
2013-06-07  2:41 ` gautier_niouzes
2013-06-07 15:52 ` mjsilva
2013-06-07 20:15   ` Dmitry A. Kazakov
2013-06-09 18:51     ` MatthiasR
2013-06-08  6:22   ` Simon Wright
2013-06-08 23:23     ` mjsilva
2013-06-10 11:07   ` Rego, P.
2013-06-13 13:30     ` Rego, P.
2013-06-17  6:35       ` Jacob Sparre Andersen
2013-06-22  8:17         ` MatthiasR
2014-03-18  0:04           ` Rego, P.
2013-06-11  7:52 ` Maciej Sobczak
2013-06-11  9:35   ` J-P. Rosen
2013-06-11 12:09   ` John Doe
2013-06-12  7:58 ` Maciej Sobczak
2013-06-12 11:01   ` G.B.
2013-06-12 20:01   ` Robert A Duff
2013-06-12 20:36     ` Georg Bauhaus
2013-06-13  7:38     ` Maciej Sobczak
replies disabled

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