comp.lang.ada
 help / color / mirror / Atom feed
* The old "Object.Method" syntax debate
@ 2003-05-21 15:26 Marc A. Criley
  2003-05-21 15:47 ` David C. Hoos
                   ` (2 more replies)
  0 siblings, 3 replies; 76+ messages in thread
From: Marc A. Criley @ 2003-05-21 15:26 UTC (permalink / raw)


Yeah, I'm bringing this up.  Kill the thread if your eyes just rolled
up into your head %-)

The reason I'm mentioning this is because of something I just read in
Martin Carlisle, Sward, and Humphries' paper "Weaving Ada 95 into the
.Net Environment" (http://www.adapower.net/a_sharp/asharp.pdf).

While this has been available online for awhile I only now read it in
my recent issue of Ada Letters.

What caught my attention was an almost peripheral mention of modifying
GNAT to recognize the Object.Method syntax: "Ada 95 has often been
criticized for making the syntax of dispatching method calls the same
as the imperative procedure calls. [...]  We have modified the
compiler to allow the same object.method syntax [...]  We have also
performed this modification to the Windows 3.15 version of GNAT. It
required only 127 non-blank, non-comment lines of Ada code. We expect
this syntax will make it easier for students to understand
object-oriented programming. Since we also support the standard Ada 95
syntax, we still have the nicer Ada syntax for operators (x+y instead
of x."+"(y))."

I've pretty much always thought of this as a non-issue not worth all
the bandwidth that's been expended on it, since it's a matter of
syntactic sugar.

But reading that Carlisle's team changed only 127 SLOC in GNAT 3.15 to
support it, I'm thinking that if it's that cheap to change in a
compiler (and I know there's all the regression testing and LRM
updates and so on that would have to accompany such a move), then
maybe it's worth it to allow the alternate syntax and remove one of
the admittedly vacuous objections to Ada raised by the language's
critics.

Marc A. Criley



^ permalink raw reply	[flat|nested] 76+ messages in thread
* RE: The old "Object.Method" syntax debate
@ 2003-05-23 17:39 Lionel.DRAGHI
  0 siblings, 0 replies; 76+ messages in thread
From: Lionel.DRAGHI @ 2003-05-23 17:39 UTC (permalink / raw)
  To: comp.lang.ada



| -----Message d'origine-----
| De: Steve [mailto:nospam_steved94@attbi.com]
...
| 
| If only we could add an alternate syntax for defining the 
| methods (functions
| and procedures) associated with an object, such as:
| 
|   type obj is tagged
|     record
|       field : Integer;
|       function Fun1( in; value : in integer ) return Integer;
|       procedure Proc1( in out; value : in out integer );
|     end record;
| 
| Yeah, I've mentioned this before, and nobody seems to agree 
| with me, but I
| still hate dealing with "freezing rules" to figure out where 
| dispatching
| operations end.

I agree with you, Steve, you're no more alone :-) 
Some construction to clearly bound object limits would be good for
readability.

The former suffer from an already raised point here, which is that the
declared profile is not the used profile, and this is not so good for
readability.

Note also that this is not strictly related to the "Object.Method" debate,
as one could consider using your declaration syntax with the current:
Proc1 (Obj, Value, integer);
while forbidding:
Obj.Proc1 (Value, integer);

...
| 
| This is one of the very few places I like C++ and Java syntax 
| better than Ada.
I unfortunatly agree. 
Sticking to Ada 83 syntax as much as possible was a really good goal, but
due to for example to freeze rules, i am not sure that a more different
syntax would have been more difficult to implement within compiler. 

Lionel Draghi.



^ permalink raw reply	[flat|nested] 76+ messages in thread
* RE: The old "Object.Method" syntax debate
@ 2003-05-23 17:59 Lionel.DRAGHI
  2003-05-27  9:17 ` John McCabe
  0 siblings, 1 reply; 76+ messages in thread
From: Lionel.DRAGHI @ 2003-05-23 17:59 UTC (permalink / raw)
  To: comp.lang.ada

| -----Message d'origine-----
| De: john@nospam.demon.co.uk [mailto:john@nospam.demon.co.uk]
...
| You could have something like:
| 
| tagged package X is
|    a : integer;
|    b : float;
| 
|    procedure method;
| end X;
| 
| So 'a' and 'b' would be object attributes and 'method' would be an
| object method. This sort of package would essentially define a single
| tagged type without all of the record definition and controlling
| parameters etc.
| 
| Further you could use:
| 
| tagged package Y is new X with
|    c : some_enumerated_type;
| end Y;
| etc..
| 
I find this pretty elegant, although using the "package" keyword leads to
the class/module confusion that Ada currently avoid.
And removing "package" brings us not so far from Steve proposal, isn't it?

-- 
Lionel Draghi.



^ permalink raw reply	[flat|nested] 76+ messages in thread
* RE: The old "Object.Method" syntax debate
@ 2003-06-03 17:23 Lionel.DRAGHI
  2003-06-04  8:27 ` John McCabe
  0 siblings, 1 reply; 76+ messages in thread
From: Lionel.DRAGHI @ 2003-06-03 17:23 UTC (permalink / raw)
  To: comp.lang.ada



| -----Message d'origine-----
| De: john@nospam.demon.co.uk [mailto:john@nospam.demon.co.uk]
...
| 
| > although using the "package" keyword leads to
| > the class/module confusion that Ada currently avoid.
| 
| That is a fair point, but it would be interesting to know how much of
| the Ada code written in under the 'object-oriented' paradigm actually
| uses a single tagged type per package. Over a period of around 3 years
| I worked in 2 separate companies where this was pretty much the case.
| In fact, in both cases the code structure was automatically generated.

I don't think it's a good practice. I find awkward to create create a child
for a class that perfectly fit in the same package.

Simple coding rules are good, but enforcing one class per package (and
calling it always "Object", or "Class") just bring Ada down to other
langages that do not have a strong modularity support and use classes for
this purpose.
Scattering strongly coupled classes on many packages lower readability. 

And there is always a better name than "Object" or "Class". 
Similarly, calling a formal "This" is, i think, a bad practice, there is
always a better name.

Automatically generated code often lead to this, not only because it
simplify the code generator, but because tools (and UML) do not provide
serious support for Ada modularity. 
Most tools don't care, they just target C++ or Java, and so are mainly
"class translator".

-- 
Lionel Draghi




^ permalink raw reply	[flat|nested] 76+ messages in thread

end of thread, other threads:[~2003-06-04  8:27 UTC | newest]

Thread overview: 76+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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