comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: The old "Object.Method" syntax debate
Date: Fri, 23 May 2003 10:34:16 +0200
Date: 2003-05-23T10:34:16+02:00	[thread overview]
Message-ID: <bakm9r$oh3n$1@ID-77047.news.dfncis.de> (raw)
In-Reply-To: 3ecdd296$1@epflnews.epfl.ch

Rodrigo Garcia wrote:

> "David C. Hoos" <david.c.hoos.sr@ada95.com> wrote in message
> news:vcprq15q8m344e@corp.supernews.com...
>> I dod not mean to suggest that the availability of "IntelliSense"
> justified
>> the
>> new syntax.  The new syntax would eliminate some code redundancy, as
>> the AI points out.
> 
> I agree that is the point of the AI.
> 
>> > I am one of those who suspect that the new syntax would add more
> confusion
>> > than advantages to the language.
>> As I pointed out in an earlier post, this syntax exists in Ada already
>> for
>> protected types.  See, for example line 54 of phil.adb of the dining
>> philosophers
>> demonstration program that comes with GNAT:
>>
>>       Room.Sticks (First_Grab).Pick_Up;
>>
>> Room.Sticks (First_Grab) is the object; Pick_Up is the operation.
> 
> Well, I heard that protected types syntax was also subject of strong
> discussions and I can understand why.

Maybe because it is ugly? (:-))

Anyway prefix syntax exists also in the form of attributes. Strangely 
enough, that nobody has yet proposed to replace X'Length with X.Length. It 
would so OO-O-Oh! (:-))

> Nevertheless, protected types are
> declared in a different way than tagged types. They already encapsulate
> their subprograms and entries in their definition. Their syntax is more
> similar to that used for declaring classes in mainstream OO languages so I
> see natural to use the Object.Operation notation with protected types.
> Even in your example you have the name of the package (Room), so they do
> not "hide" the use clause.
> 
> However, primitive operation declarations of tagged types are encapsulated
> in the package as with any other kind of type and the syntax is inherently
> different. Why should we be able to use the new syntax only with tagged
> types?
> 
> Hmm... Maybe it should be the other way round and keep the tagged type
> syntax for protected types. I should propose "protected records" whose
> primitive operations were run in mutual exclusion... what to do with
> entries
> then?   :^)

Entries are just subprograms with queues. If an entry has several protected 
arguments then a call to it should start a protected action on both. As for 
implementation, it should be no problem in case single processor - single 
lock. For multiple processors, I do not know, anyway it will be never 
accepted. (:-))

Same for task entries. They also (unfortunately) have prefix syntax which 
prevents potentially interesting one-to-many rendezvous. And even more 
misterious entries of both a protected object and a task, sort of 
"protected rendezvous"! (:-))

--
As for prefix syntax, I would prefer an explicit renaming:

procedure Foo (X : T, Y : T);
procedure T.Foo (Z : T) renames Foo (X=>Z, Y=>with); -- (:-))

However prefix syntax is too often misleading. It is unusable for binary 
operations and multiple dispatching operations (if Ada would have them).

-- 
Regards,
Dmitry A. Kazakov
www.dmitry-kazakov.de



  reply	other threads:[~2003-05-23  8:34 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-21 15:26 The old "Object.Method" syntax debate Marc A. Criley
2003-05-21 15:47 ` David C. Hoos
2003-05-21 16:21   ` Jacob Sparre Andersen
2003-05-21 16:34     ` Robert A Duff
2003-05-21 16:43       ` Preben Randhol
2003-05-21 17:13         ` Robert A Duff
2003-05-21 17:13         ` David C. Hoos
2003-05-21 18:21           ` Preben Randhol
2003-05-21 19:43             ` David C. Hoos
2003-05-21 20:36               ` Preben Randhol
2003-05-22  3:24                 ` David C. Hoos
2003-05-22  2:31             ` Alexander Kopilovitch
2003-05-21 18:32           ` Preben Randhol
2003-05-22  9:41       ` Xavier Nicollin
2003-05-22 14:56         ` Robert A Duff
2003-05-22 16:02           ` Xavier Nicollin
2003-05-23  2:56         ` Wesley Groleau
2003-05-21 16:50     ` David C. Hoos
2003-05-21 16:36   ` Preben Randhol
2003-05-21 16:55     ` Vinzent Hoefler
2003-05-21 18:03       ` Preben Randhol
2003-05-21 18:17         ` David C. Hoos
2003-05-21 18:22           ` Preben Randhol
2003-05-21 20:53             ` tmoran
2003-05-22  2:11               ` Preben Randhol
2003-05-22  4:04                 ` Dale Stanbrough
2003-05-22  7:34         ` Ole-Hjalmar Kristensen
2003-05-23  0:35         ` Hyman Rosen
2003-05-21 17:02   ` David C. Hoos
2003-05-21 17:55   ` Warren W. Gay VE3WWG
2003-05-21 19:54   ` Bobby D. Bryant
2003-05-21 20:37     ` Preben Randhol
2003-05-22 14:32   ` Rodrigo Garcia
2003-05-22 15:39     ` David C. Hoos
2003-05-23  7:49       ` Rodrigo Garcia
2003-05-23  8:34         ` Dmitry A. Kazakov [this message]
2003-05-23 18:35           ` Alexander Kopilovitch
2003-05-25  5:38             ` Robert I. Eachus
2003-05-25  9:13               ` Dmitry A. Kazakov
2003-05-27  9:50                 ` John McCabe
2003-05-27 16:02                   ` Warren W. Gay VE3WWG
2003-05-28  8:24                   ` Dmitry A. Kazakov
2003-05-28 12:36                     ` Lutz Donnerhacke
2003-05-28 13:14                       ` Preben Randhol
2003-05-28 15:01                         ` Lutz Donnerhacke
2003-05-29  9:17                       ` Dmitry A. Kazakov
2003-05-30 10:41                         ` Lutz Donnerhacke
2003-05-30 20:13                           ` Randy Brukardt
2003-06-02  9:11                             ` Lutz Donnerhacke
2003-05-31  9:29                           ` Dmitry A. Kazakov
2003-05-28  3:02               ` Alexander Kopilovitch
2003-05-28  8:07                 ` John McCabe
2003-05-29  0:55                   ` Alexander Kopilovitch
2003-05-22 17:03     ` Gautier Write-only
2003-05-23 14:43   ` Steve
2003-05-23 14:51     ` Preben Randhol
2003-05-23 15:21     ` John McCabe
2003-05-23 23:43     ` Robert A Duff
2003-05-25  5:42     ` Hyman Rosen
2003-05-25 14:40       ` Steve
2003-05-25 21:21         ` Gautier Write-only
2003-05-23  7:58 ` John McCabe
2003-05-23  8:39   ` Preben Randhol
2003-05-23 15:12     ` John McCabe
2003-05-23 15:18       ` Preben Randhol
2003-05-23 17:32     ` Stephen Leake
2003-05-27  9:09       ` John McCabe
2003-05-28 11:47       ` Georg Bauhaus
2003-05-28 16:14         ` Stephen Leake
2003-05-28 18:23           ` Georg Bauhaus
2003-05-23 20:45 ` steve_H
  -- strict thread matches above, loose matches on Subject: below --
2003-05-23 17:39 Lionel.DRAGHI
2003-05-23 17:59 Lionel.DRAGHI
2003-05-27  9:17 ` John McCabe
2003-06-03 17:23 Lionel.DRAGHI
2003-06-04  8:27 ` John McCabe
replies disabled

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