comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada design bug or GNAT bug?
Date: Fri, 3 Jul 2015 22:24:20 -0500
Date: 2015-07-03T22:24:20-05:00	[thread overview]
Message-ID: <mn7jl5$p6l$1@loke.gir.dk> (raw)
In-Reply-To: 4228c0ea-837d-42a0-b2a8-a98d8d30f820@googlegroups.com

"Shark8" <onewingedshark@gmail.com> wrote in message 
news:4228c0ea-837d-42a0-b2a8-a98d8d30f820@googlegroups.com...
On Thursday, July 2, 2015 at 6:04:50 PM UTC-6, Randy Brukardt wrote:
>>
>> The reason Ada has anonymous access parameters was a desire (for Ada 9x)
>> that code from existing OOP languages like C++ could be directly 
>> converted
>> to Ada without having to think at all (thinking being necessary to get 
>> rid
>> of access types).
>
>Do you think, in hindsight that (anonymous access parameters) was a 
>mistake?

Surely. They were introduced mainly to solve two problems: the missing "in 
out" parameters for functions (and that they solved so imperfectly that Ada 
2012 allows "in out" parameters for functions), and to allow dispatching on 
access types (something I'm dubious was necessary in the first place - 
dispatching on .all works in virtually all cases that I've seen). Plus they 
have weird dynamic accessibility semantics, which provides a tripping hazard 
(as Bob Duff would call it) -- an exception but only in unusual cases -- and 
a performance drain. "in out" has essentially the same semantics put without 
the hazard or performance issue.

...
>I think I remember getting an error-message in GNAT awhile back
>about return and reference semantics... wasn't that something that Ada95
>had but was later forbidden in Ada 2005?

Because it was near-nonsense; you had to return a global variable -- but you 
should be avoiding global variables as much as possible, not requiring them. 
They had a few uses, but not enough to preserve.

> -- Also, do you think it would have been better to have extended-return
> signal to the compiler a desire for a build-in-place return-object?

Probably not, build-in-place semantics isn't practical for all non-limited 
types (think normal assignment, can't build-in-place because if an exception 
occurs the original value has to be intact).

> Also, I seem to recall your dislike of INTERFACEs -- in hindsight, what
> would you have done differently if you needed the mechanism of
> "Type T has functions X, Y, and X" applied to a group of types?
> Generics, or some variations thereof?

I wouldn't need such a mechanism. :-) I'm dubious of the value of that in 
the first place -- it's not zero, but it's close enough that it isn't worth 
hairing up a language or implementation to get it.

>>> with P1; use P1;
>>> package P2 is
>>>   type T3 is new T1 with private;
>> private
>>>   type T3 is new T2 with null record; -- Legal!
>>
>>This is only legal because of a hack, which I was very much against
>>introducing. If you have an extension component, this is illegal:
>>
>>    type T4 is new T2 with record C : Character := '1'; end record; --  
>> Illegal!!!

>Why is this hack required?/How was it justified? How would you address the 
>problem w/o resorting to this hack?

The thread that Dmitry and I have been having answers this question, and I 
don't want to spend time to repeat it.

>Other than those specifics, I'm quite interested to know what you regard to 
>be mistakes in Ada's design.

Someday I'm going to write a paper/blog post on that. But not today. I'd 
like to accomplish some work at some point in the month of July. :-)

                        Randy.


  reply	other threads:[~2015-07-04  3:24 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-20 18:55 Ada design bug or GNAT bug? Dmitry A. Kazakov
2015-06-21  2:42 ` Randy Brukardt
2015-06-21  6:47   ` Dmitry A. Kazakov
2015-06-22 17:39     ` Randy Brukardt
2015-06-22 18:16       ` Dmitry A. Kazakov
2015-06-23 11:00         ` G.B.
2015-06-23 14:27           ` Dmitry A. Kazakov
2015-06-23 11:45         ` G.B.
2015-06-23 14:30           ` Dmitry A. Kazakov
2015-07-02 22:22         ` Randy Brukardt
2015-07-03  8:02           ` Dmitry A. Kazakov
2015-07-03 17:33             ` Randy Brukardt
2015-07-03 21:34               ` Dmitry A. Kazakov
2015-07-04  3:11                 ` Randy Brukardt
2015-07-04 12:14                   ` Dmitry A. Kazakov
2015-07-05  0:53                     ` Randy Brukardt
2015-06-22 18:27       ` Shark8
2015-06-23 11:51         ` vincent.diemunsch
2015-06-23 19:55           ` Shark8
2015-06-23 13:06         ` vincent.diemunsch
2015-06-23 14:30           ` David Botton
2015-06-23 15:57             ` Niklas Holsti
2015-06-23 16:01               ` G.B.
2015-06-23 18:05               ` David Botton
2015-06-23 19:38               ` David Botton
2015-06-23 14:38           ` Dmitry A. Kazakov
2015-06-23 16:57             ` Vincent
2015-06-23 17:15               ` Dmitry A. Kazakov
2015-06-23 19:14                 ` vincent.diemunsch
2015-06-23 19:33                   ` Dmitry A. Kazakov
2015-06-23 17:42           ` Jeffrey R. Carter
2015-07-02 22:06           ` Randy Brukardt
2015-07-04  1:52             ` Shark8
2015-07-04  3:24               ` Randy Brukardt [this message]
2015-07-04 11:02                 ` Build-in-place semantics? (Was: Ada design bug or GNAT bug?) Jacob Sparre Andersen
2015-07-04 12:15                   ` Dmitry A. Kazakov
2015-07-05  0:45                     ` Randy Brukardt
2015-07-05  7:10                       ` Dmitry A. Kazakov
2015-07-05  0:40                   ` Randy Brukardt
2015-07-04 14:05                 ` Ada design bug or GNAT bug? Bob Duff
2015-07-04  7:46               ` Simon Wright
2015-07-04 12:00                 ` Björn Lundin
2015-07-05  0:48                   ` Randy Brukardt
2015-07-06 12:37             ` Vincent
2015-07-06 20:05               ` Randy Brukardt
2015-07-07  8:06               ` Dmitry A. Kazakov
replies disabled

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