comp.lang.ada
 help / color / mirror / Atom feed
From: "Vladimir Olensky" <vladimir_olensky@yahoo.com>
Subject: Re: Ada OO Mechanism
Date: 1999/05/31
Date: 1999-05-31T00:00:00+00:00	[thread overview]
Message-ID: <928161154.329.88@news.remarQ.com> (raw)
In-Reply-To: 7ircia$ued@drn.newsguy.com

chris@nospam wrote in message <7ircia$ued@drn.newsguy.com>...
>
>In Modula-3, you have a modula, which is same as an Ada package.
>but also, you have what is called an OBJECT, (which looked
>like a RECORD), which contains DATA part, and METHODS part.
>
>Inside a modula, you can declare an OBJECT.
>
>So, here we have a language, which I thought was very similar to
>Ada, but used the familiar class like construct for the OO type.


==============================================

 As a matter of fact  M3 allows you to use both ways to invoke
methods on objects if my nemory serves me right.
----------------------------------------------------------------------------
------
--   Object.method  and method (object) are both valid calls for M3.
----------------------------------------------------------------------------
------
It just depends on the intention of the Interface  Module
designer who allows you to use  one of them or both (first one in most
cases).
Usually implementation modules use the method (object) syntax
but it is hidden from the user (as the implementation is not
visible to customer).

As M3 allows to have several different interfaces
to the same implementation module (exploiting so called
partial revelation) so it is possible to have  two
sets of operation (with different syntax) to be in the
different interfaces to given implementation as well.
M3 is extremely flexible regarding this.

Moreover, depending on how you defined your object methods
you may even allow user to redefine object methods during program
execution (just changing procedure address in VMT).
(e.g.during execution you can create array of bytes representing
some  chain of assembler instructions and then call it when needed).

It is just an example, more safe is to have object method which
can call any other procedure with the given profile.

If anyone have a look at M3 sources he/she can find there a lot of
extremely interesting things.
May be M3 experience will be considered seriously  some time in the future.

I wonder why Averstar sells and supports only Ada 95 and Modula-GM. It would
be logical to have M3 in the list of it's products .
It would be very impressive set: Ada 95, . AppletMagic, Modula-3, Modula-GM.

Regards,
Vladimir Olensky

Here some code from M3 sources  as an  illustration:
-------------------------------------

INTERFACE GO;

EXCEPTION PropUndefined;
EXCEPTION StackError;

TYPE
  Shape = {Complex, NonConvex, Convex, Unknown};

TYPE
  T <: Public;
  Public = ProxiedObj.T OBJECT
  METHODS
    init () : T;

   <stripped code>

    setName (name : TEXT);
    getName () : TEXT;

   <stripped code>

    pushMouseCB (cb : MouseCB.T);
    popMouseCB () RAISES {StackError};

   <stripped code>

  END;


----------------------------------------------------------------------------
----

Copyright (C) 1994, Digital Equipment Corp.
Created by Marc Najork

MODULE GO EXPORTS GO, GOPrivate;

  <stripped code>

REVEAL
  T = Private BRANDED OBJECT
  OVERRIDES
    init := Init;

    <stripped code>

    setName  := SetName;
    getName  := GetName;

    pushMouseCB   := PushMouseCB;
    popMouseCB    := PopMouseCB;

    <stripped code>

  END;

PROCEDURE Init (self : T) : T =
  BEGIN
    self.props   := NIL;
    self.damaged := TRUE;
    self.name    := NIL;
    self.dl      := 0;

    self.mouseCBstack    := NEW (MouseCBStack.T).init ();
    self.positionCBstack := NEW (PositionCBStack.T).init ();
    self.keyCBstack      := NEW (KeyCBStack.T).init ();

    RETURN self;
  END Init;


PROCEDURE SetName (self : T; name : TEXT) =
  BEGIN
    self.name := name;
  END SetName;

PROCEDURE GetName (self : T) : TEXT =
  BEGIN
    RETURN self.name;
  END GetName;

  <stripped code>

PROCEDURE PushMouseCB (self : T; cb : MouseCB.T) =
  BEGIN
    self.mouseCBstack.push (cb);
  END PushMouseCB;

PROCEDURE PopMouseCB (self : T) RAISES {StackError} =
  BEGIN
    self.mouseCBstack.pop ();
  END PopMouseCB;

  <stripped code>

BEGIN
  Transform := NEW (Transform_PN).init (Matrix4.Id);
END GO.

































  parent reply	other threads:[~1999-05-31  0:00 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-20  0:00 Ada OO Mechanism Shawn M. Root
1999-05-20  0:00 ` Samuel Mize
1999-05-20  0:00   ` David Botton
1999-05-20  0:00     ` Samuel Mize
1999-05-20  0:00       ` David Botton
1999-05-24  0:00   ` Hyman Rosen
1999-05-24  0:00     ` Robert Dewar
1999-05-24  0:00       ` Hyman Rosen
1999-05-24  0:00         ` Mike
1999-05-25  0:00           ` Robert Dewar
1999-05-24  0:00         ` David Starner
1999-05-24  0:00           ` bob
1999-05-24  0:00             ` David Starner
1999-05-25  0:00               ` Ole-Hjalmar Kristensen
1999-05-25  0:00                 ` Florian Weimer
1999-05-25  0:00                 ` Mark A Biggar
1999-05-25  0:00                   ` Hyman Rosen
1999-05-25  0:00                     ` Samuel Mize
1999-05-25  0:00                       ` Hyman Rosen
1999-05-25  0:00                         ` Brian Rogoff
1999-05-25  0:00                           ` Jim
1999-05-26  0:00                           ` Robert Dewar
1999-05-26  0:00                             ` Brian Rogoff
1999-05-25  0:00                         ` Samuel Mize
1999-05-25  0:00                           ` Chris
1999-05-25  0:00                             ` David Botton
1999-05-27  0:00                               ` Aidan Skinner
1999-05-27  0:00                                 ` Gautier
1999-05-27  0:00                             ` Samuel Mize
1999-05-25  0:00                         ` Richard D Riehle
1999-05-25  0:00                           ` Hyman Rosen
1999-05-26  0:00                             ` Ray Blaak
1999-05-26  0:00                               ` Hyman Rosen
1999-05-26  0:00                               ` Richard D Riehle
1999-05-26  0:00                                 ` Hyman Rosen
1999-05-27  0:00                                   ` Richard D Riehle
1999-06-05  0:00                                     ` Matthew Heaney
1999-06-07  0:00                                       ` Hyman Rosen
1999-05-28  0:00                                   ` Laurent Guerby
1999-06-05  0:00                                   ` Matthew Heaney
1999-06-07  0:00                                     ` Hyman Rosen
1999-06-08  0:00                                       ` Matthew Heaney
1999-06-08  0:00                                         ` Hyman Rosen
1999-06-08  0:00                                           ` Samuel Mize
1999-06-08  0:00                                             ` Hyman Rosen
1999-06-08  0:00                                       ` Robert Dewar
1999-06-08  0:00                                         ` Stanley R. Allen
1999-06-08  0:00                                         ` Markus Kuhn
1999-06-08  0:00                                           ` Stanley R. Allen
     [not found]                           ` <t7zp2sr6yf.fsf@calumny.jyacc.c <t7r9nmz8ou.fsf@calumny.jyacc.com>
1999-06-08  0:00                             ` Larry Kilgallen
1999-06-08  0:00                               ` Hyman Rosen
1999-06-14  0:00                                 ` Robert A Duff
     [not found]                           ` <t7zp2sr6yf.fsf@calumny.jyacc.c <t7emjmmx8w.fsf@calumny.jyacc.com>
1999-06-08  0:00                             ` Larry Kilgallen
1999-06-08  0:00                               ` Hyman Rosen
1999-06-08  0:00                                 ` Tucker Taft
1999-06-08  0:00                                   ` Brian Rogoff
1999-06-09  0:00                                   ` Tucker Taft
1999-06-09  0:00                                   ` Robert Dewar
     [not found]                                   ` < <375E92CB.27850620@averstar.com>
1999-06-09  0:00                                     ` Brian Rogoff
1999-06-14  0:00                                       ` Robert A Duff
1999-06-09  0:00                                 ` Matthew Heaney
1999-06-09  0:00                                 ` Samuel Mize
     [not found]                           ` <t7zp2sr6yf.fsf@calumny.jyacc.c <375d9a3d.e1cccc63@averstar.com>
1999-06-09  0:00                             ` Larry Kilgallen
1999-06-09  0:00                               ` Tucker Taft
1999-05-27  0:00                         ` Samuel Mize
1999-05-27  0:00                           ` Jon S Anthony
1999-05-27  0:00                         ` Samuel Mize
1999-05-27  0:00                           ` Hyman Rosen
1999-05-28  0:00                             ` Laurent Guerby
1999-05-28  0:00                               ` Richard D Riehle
1999-05-28  0:00                                 ` Tom Moran
1999-05-28  0:00                             ` Samuel Mize
1999-05-25  0:00                     ` Richard D Riehle
1999-05-25  0:00                       ` David Botton
1999-05-26  0:00                         ` Tom Moran
1999-05-27  0:00                       ` Aidan Skinner
1999-05-28  0:00                     ` Robert I. Eachus
1999-05-28  0:00                       ` Brian Rogoff
1999-05-29  0:00                       ` Ehud Lamm
1999-05-30  0:00                         ` chris
1999-05-30  0:00                           ` Harry George
1999-05-30  0:00                             ` Vladimir Olensky
1999-05-31  0:00                               ` Robert Dewar
1999-05-30  0:00                           ` Robert Dewar
1999-05-31  0:00                           ` Vladimir Olensky [this message]
1999-06-03  0:00                             ` Dale Stanbrough
1999-06-02  0:00                               ` mike
1999-06-03  0:00                                 ` Robert Dewar
1999-06-06  0:00                                   ` David Botton
1999-06-07  0:00                                     ` Robert Dewar
1999-06-01  0:00                           ` Richard D Riehle
1999-06-03  0:00                         ` Matthew Heaney
1999-06-03  0:00                     ` Matthew Heaney
1999-05-25  0:00     ` Samuel Mize
1999-05-25  0:00       ` Hyman Rosen
1999-05-25  0:00         ` David Starner
1999-05-26  0:00         ` Laurent Guerby
1999-05-26  0:00           ` Hyman Rosen
1999-05-28  0:00             ` Laurent Guerby
1999-06-01  0:00               ` Hyman Rosen
1999-06-03  0:00                 ` Fraser Wilson
1999-05-26  0:00         ` Ole-Hjalmar Kristensen
1999-06-03  0:00     ` Matthew Heaney
1999-06-03  0:00       ` Hyman Rosen
1999-05-21  0:00 ` Dale Stanbrough
1999-05-20  0:00   ` bob
1999-05-21  0:00     ` Dale Stanbrough
1999-05-21  0:00   ` Richard D Riehle
1999-05-21  0:00     ` Shawn M. Root
1999-05-21  0:00       ` Richard D Riehle
1999-05-25  0:00         ` Shawn M. Root
1999-05-21  0:00     ` Marin David Condic
1999-05-21  0:00       ` Steve
1999-05-21  0:00       ` Dan Nagle
1999-05-24  0:00         ` Marin David Condic
1999-05-25  0:00   ` Don Overheu
replies disabled

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