comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada Distilled by Richard Riehle
Date: Tue, 7 Aug 2018 00:01:14 +0200
Date: 2018-08-07T00:01:14+02:00	[thread overview]
Message-ID: <pkagf8$p9b$1@gioia.aioe.org> (raw)
In-Reply-To: 258b9e90-07e7-477c-99ba-204e328aea11@googlegroups.com

On 2018-08-06 21:33, Vincent wrote:
> Le samedi 28 juillet 2018 17:41:53 UTC+2, Dmitry A. Kazakov a écrit :
>   
>> Ada 95 never had methods nested in type declaration. (Ada 83 did this
>> error for protected objects and tasks, but the lesson was learned)
> 
> What is the problem with methods nested in type declaration ?

That no type has operations that only involve that type. Nested 
declarations prevent most of the types to have classes. In a sane 
language design all types must have classes.

> It seems to me that with the Ada95 OO style, we have awful "freezing rules", and less visibility of which operation is dispatching and which is not.

How are they awful? Clearly an incomplete type cannot be fully used. So 
there must be a freezing point where the type becomes usable.

This has nothing to do with style, of which there is no choice. The only 
possible style is the Ada's one. All C++ proposals for MD switch to Ada 
style at once. Operations simply do not belong to a single type, there 
is no way they can be nested in a single type declaration.

Considering dispatching, all operations should always be dispatching. 
Even a class-wide operation is dispatching on the class class etc.

>> Yes, Ada's OO model is the only correct one, IMO.
>> The concept of operations nested class type declaration is evident garbage in the light of MD.
> 
> But that's a paradox since as you mentioned, this Ada model is not able to deal with MD !

On the contrary, nested declaration of operations automatically preclude 
MD. Where to place Print (Surface, Text)? In Ada model this problem does 
not exist:

    type Surface is ...;
    type Text is ...;
    procedure Print (X : in out Surface; Y : Text);

Problems with MD lie elsewhere.

> In both cases (in Ada and in languages that nest methods in types) one needs to deal with multiple dispatch "at hand" by an ad hoc procedure that uses class wide arguments and test them.

That is not MD and it cannot handle MD except for few very special 
cases. In other cases it violates basic implementation requirements like 
compile time guaranty that all combinations of types are covered and 
that no faulty implementations are inherited.

> For the obvious reason that there is no evident ordering of a pair of elements, event if each element is ordered.

MD dispatching table is a multidimensional array. There is no ordering 
and therefore it is impossible to inherit all MD bodies. But some bodies 
can and must be inherited.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2018-08-06 22:01 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-15 18:09 Ada Distilled by Richard Riehle rabbibotton
2018-07-16  1:02 ` Shark8
2018-07-21  6:07   ` Randy Brukardt
2018-07-26  0:42     ` rabbibotton
2018-07-26 20:17       ` Shark8
2018-07-26 21:10         ` Jeffrey R. Carter
2018-07-27  3:01           ` Paul Rubin
2018-07-27 14:32           ` rabbibotton
2018-07-27 20:18             ` Paul Rubin
2018-07-27 17:02           ` Shark8
2018-07-27 14:30         ` rabbibotton
2018-07-27 17:11           ` Shark8
2018-07-27 18:52             ` Dan'l Miller
2018-07-27 20:07               ` Dmitry A. Kazakov
2018-07-27 20:38                 ` Dan'l Miller
2018-07-27 21:32                   ` Dmitry A. Kazakov
2018-07-28  2:41                     ` Dan'l Miller
2018-07-28  7:10                       ` Dmitry A. Kazakov
2018-07-28 15:01                         ` Dan'l Miller
2018-07-28 15:41                           ` Dmitry A. Kazakov
2018-07-28 16:05                             ` Dan'l Miller
2018-08-06 19:33                             ` Vincent
2018-08-06 22:01                               ` Dmitry A. Kazakov [this message]
2021-12-09 11:13                                 ` Kevin Chadwick
2018-07-27 21:34                 ` Shark8
2018-07-27 22:16                   ` Dmitry A. Kazakov
2018-07-28  3:52                 ` Dan'l Miller
2018-07-28  7:12                   ` Dmitry A. Kazakov
2018-07-27 20:35               ` Paul Rubin
replies disabled

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