comp.lang.ada
 help / color / mirror / Atom feed
From: Ray Blaak <blaak@infomatch.com>
Subject: Re: friend classes in ada95
Date: 2000/04/19
Date: 2000-04-19T00:00:00+00:00	[thread overview]
Message-ID: <uln2aq6oo.fsf@infomatch.com> (raw)
In-Reply-To: 38FD7F1A.E4906194@icn.siemens.de

Alfred Hilscher <Alfred.Hilscher@icn.siemens.de> writes:
> I would have preferred this notation too.
> 1. "class type t is ..."  and  "t'class"   would be more clear than  
> "type t is tagged ..."   and   "t'class"
> 2. I have to write   task type t is    and not    type t is concurrent
> ...

And "protected type t", not "type t is protected". 

For that matter, given a protected type, one also writes t.Foo instead of
Foo(t).

I know people here feel strongly about the normal procedural syntax for method
calls, and it certainly helps to avoid problems, especially with defining
binary operations, but having been away from Ada for a while, and using
Delphi, C++, and Java, I have found I have changed my mind.

I am realizing the saying obj.Method is a more natural way of expressing how I
*think*. 

I like Delphi's way of doing OO:

  type TObject = class (ParentClass, Interface1, Interface2, ...)
  private
    attribute : Integer;
  public
    procedure Foo(v : Integer);
  end;

and then the implementations look like:

  procedure TObject.Foo(v : Integer);
  begin
    self.attribute := v;
  end;

I consider myself to be an experienced OO programmer, and at one time was an
expert Ada programmer, and I certainly "get" Ada's way of doing OO with tagged
types, but I find the syntax now for doing simple OO stuff tedious and not as
clear to the reader as it should be.

Multiple inheritance from interfaces should be easy. Declaring virtual methods
should be easy. In Ada, the caller decides if dispatching is desired by
ensuring a method call is in terms of a class wide parameter or not. I think
it should be the class implementor that decides, since if the caller gets it
wrong, it is a silent error.

Delphi's style makes overriding and polymorphism clear in the code:

  type TObject = class(TBaseObject)
    procedure Foo; override; // required if TBaseObject.Foo is virtual
    procedure DispatchOnMe; virtual;
  end;

Ada's style is the most "correct" since we have a true building block
approach, but I just wish the syntax was a little better.

I am spouting religious opinions to be sure, I generally like Ada very much,
and its OO style is now standardized and not going to change any time soon,
but I will still complain about it now and again.

-- 
Cheers,                                        The Rhythm is around me,
                                               The Rhythm has control.
Ray Blaak                                      The Rhythm is inside me,
blaak@infomatch.com                            The Rhythm has my soul.




  reply	other threads:[~2000-04-19  0:00 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-14  0:00 friend classes in ada95 Stefan Folkesson
2000-04-14  0:00 ` John J. Rusnak
2000-04-14  0:00 ` Julian Day
2000-04-14  0:00   ` Steve Folly
2000-04-14  0:00     ` Robert A Duff
2000-04-17  0:00       ` John J. Rusnak
2000-04-18  0:00         ` Vincent Marciante
2000-04-18  0:00           ` John Rusnak
2000-04-18  0:00       ` Steve Folly
2000-04-14  0:00 ` Florian Weimer
2000-04-14  0:00   ` Stefan Folkesson
2000-04-14  0:00 ` swhalen
2000-04-15  0:00 ` Jeff Carter
2000-04-16  0:00   ` Robert Dewar
2000-04-16  0:00     ` Jeff Carter
2000-04-16  0:00       ` David Botton
2000-04-17  0:00         ` Robert Dewar
2000-04-17  0:00           ` Hyman Rosen
2000-04-17  0:00             ` Robert Dewar
2000-04-16  0:00     ` David Botton
2000-04-17  0:00       ` Robert Dewar
2000-04-17  0:00         ` David Botton
2000-04-17  0:00         ` David Botton
2000-04-18  0:00           ` friend classes in ada95 (long) tmoran
2000-04-18  0:00             ` David Botton
2000-04-18  0:00               ` friend classes in ada95 Stanley R. Allen
2000-04-19  0:00               ` friend classes in ada95 (long) Brian Rogoff
2000-04-19  0:00                 ` David Botton
2000-04-19  0:00                 ` Hyman Rosen
2000-04-19  0:00                   ` Brian Rogoff
2000-04-23  0:00                     ` Hyman Rosen
2000-04-23  0:00                       ` Brian Rogoff
2000-04-24  0:00                         ` Hyman Rosen
2000-04-25  0:00                           ` Brian Rogoff
2000-04-25  0:00                             ` Ole-Hjalmar Kristensen
2000-04-19  0:00               ` MI, was Re: friend classes in ada95 tmoran
2000-04-19  0:00                 ` David Botton
2000-04-18  0:00       ` Geoff Bull
2000-04-18  0:00         ` Jean-Pierre Rosen
2000-04-18  0:00           ` tmoran
2000-04-18  0:00             ` John J. Rusnak
2000-04-19  0:00               ` Robert Dewar
2000-04-19  0:00               ` Geoff Bull
2000-04-19  0:00                 ` Robert Dewar
2000-04-19  0:00                 ` Jeff Susanj
2000-04-19  0:00                   ` Bill Greene
2000-04-19  0:00                   ` Robert Dewar
2000-04-19  0:00                     ` Jeff Carter
2000-04-19  0:00                       ` Ray Blaak
2000-04-20  0:00                         ` Jean-Pierre Rosen
2000-04-20  0:00                           ` Robert Dewar
2000-04-20  0:00                             ` Brian Rogoff
2000-04-20  0:00                             ` BSCrawford
2000-04-20  0:00                             ` Jean-Pierre Rosen
2000-04-20  0:00                           ` Ray Blaak
2000-04-20  0:00                             ` Jean-Pierre Rosen
2000-04-24  0:00                               ` Ray Blaak
2000-04-20  0:00                         ` Robert Dewar
2000-04-20  0:00                           ` Ray Blaak
2000-04-20  0:00                             ` Charles Hixson
2000-04-21  0:00                               ` Jon S Anthony
2000-04-21  0:00                               ` Jean-Pierre Rosen
2000-04-29  0:00                                 ` Aidan Skinner
2000-04-29  0:00                                   ` Robert I. Eachus
2000-04-20  0:00                       ` Robert Dewar
2000-04-20  0:00                         ` Jeff Carter
2000-04-21  0:00                           ` Robert Dewar
2000-04-21  0:00                             ` Jon S Anthony
2000-04-22  0:00                               ` Robert Dewar
2000-04-21  0:00                             ` Ken Garlington
2000-04-19  0:00                   ` tmoran
2000-04-19  0:00                 ` Ehud Lamm
2000-04-19  0:00                 ` David Botton
2000-04-19  0:00                   ` Robert Dewar
2000-04-20  0:00                     ` Geoff Bull
2000-04-19  0:00                   ` Robert Dewar
2000-04-19  0:00               ` Jean-Pierre Rosen
2000-04-18  0:00           ` John Rusnak
2000-04-19  0:00             ` Robert Dewar
2000-04-18  0:00           ` David Botton
2000-04-18  0:00           ` Pascal Obry
2000-04-18  0:00         ` David Botton
2000-04-17  0:00     ` Robert I. Eachus
2000-04-18  0:00       ` Robert Dewar
2000-04-19  0:00         ` Robert I. Eachus
2000-04-20  0:00           ` Robert Dewar
2000-04-20  0:00             ` Ray Blaak
2000-04-23  0:00             ` Robert I. Eachus
2000-04-19  0:00     ` Alfred Hilscher
2000-04-19  0:00       ` Ray Blaak [this message]
2000-04-19  0:00         ` Robert Dewar
replies disabled

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