comp.lang.ada
 help / color / mirror / Atom feed
* Ada features
@ 2000-01-28  0:00 Bertrand Augereau
  2000-01-28  0:00 ` Jim Rogers
  2000-01-28  0:00 ` Tucker Taft
  0 siblings, 2 replies; 4+ messages in thread
From: Bertrand Augereau @ 2000-01-28  0:00 UTC (permalink / raw)


Hello,

I would like to know if there are standard solutions for those 2 things in
Ada95 :

1) Introspection

2) The equivalence of what is done in Java by :
class MVFramework

        class Model extends Object {...}
        class View extends Object {...}
}
class MVSpreadsheetFramework extends MVFramework

        class Model {...} // Overrides class MVFramework.Model
        class View {...}
}

.i.e. overriding a nested class








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

* Re: Ada features
  2000-01-28  0:00 Ada features Bertrand Augereau
@ 2000-01-28  0:00 ` Jim Rogers
  2000-01-29  0:00   ` Bertrand Augereau
  2000-01-28  0:00 ` Tucker Taft
  1 sibling, 1 reply; 4+ messages in thread
From: Jim Rogers @ 2000-01-28  0:00 UTC (permalink / raw)


In article <86sinj$upb$1@netserv.univ-lille1.fr>,
  "Bertrand Augereau" <Augereau.Bertrand@ec-lille.fr> wrote:
> Hello,
>
> I would like to know if there are standard solutions for those 2
things in
> Ada95 :
>
> 1) Introspection

Not a term used in Ada 95.
In standard English this implies some sort of self review or
knowledge. What is your meaning here?

>
> 2) The equivalence of what is done in Java by :
> class MVFramework
>
>         class Model extends Object {...}
>         class View extends Object {...}
> }
> class MVSpreadsheetFramework extends MVFramework
>
>         class Model {...} // Overrides class MVFramework.Model
>         class View {...}
> }
>
> .i.e. overriding a nested class

Ada 95 implements inheritance through type extension.
A component of a tagged type may be another tagged type.
Each tagged type must be overridden separately.
To achieve the Ada equivalent of overriding a nested class,
you need to create a tagged type with elements which are
access to class-wide types.

There is also no direct Ada equivalent of the Java class Object.


type Model is tagged private;
...
type Model_Access is access all Model'Class;

type View is tagged private;
...
type View_Access is access all View'Class;

type FrameWork is tagged record
   This_Model : Model_Access;
   This_View  : View_Access;
end record;

Types View and Model can be extended indefinitely.
Those extensions can still used in type FrameWork.

This approach is not without problems.
Children of View and Model will possibly
have additional subprograms not in View or Model.
There is no simple way to access those subprograms without
explicitly coding a decision tree based upon the specific
tag of each descendant.

It is much easier to override behavior only, and not
both behavior and state.

In Ada behavior is overridden and data (state) is extended
through inheritance. Violating that rule makes life
difficult. It is often easier to take another look at the
problem and redesign the solution to fit the tools, instead
of fighting the tools.  This advice is good for all languages.

--
Jim Rogers
Colorado Springs, Colorado USA


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: Ada features
  2000-01-28  0:00 Ada features Bertrand Augereau
  2000-01-28  0:00 ` Jim Rogers
@ 2000-01-28  0:00 ` Tucker Taft
  1 sibling, 0 replies; 4+ messages in thread
From: Tucker Taft @ 2000-01-28  0:00 UTC (permalink / raw)


Bertrand Augereau wrote:
> 
> Hello,
> 
> I would like to know if there are standard solutions for those 2 things in
> Ada95 :
> 
> 1) Introspection

There is a new standard called "ASIS" which provides an API
for extracting information from the Ada program library.
However, this is not currently designed for use by a program
on "itself," though it might work if you run the program on
a machine where the program library is accessible at run-time.

> 2) The equivalence of what is done in Java by :
> class MVFramework
> 
>         class Model extends Object {...}
>         class View extends Object {...}
> }
> class MVSpreadsheetFramework extends MVFramework
> 
>         class Model {...} // Overrides class MVFramework.Model
>         class View {...}
> }
> 
> .i.e. overriding a nested class

This sort of "overriding" is really just "hiding".  There is
no run-time dispatching with this kind of overriding in Java (or
any other OOP that I know of).

In Ada, you might use child packages to accomplish something like this,
because the components of the enclosing package are visible within
the children, but you can hide them with components declared locally
within the child package. 

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




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

* Re: Ada features
  2000-01-28  0:00 ` Jim Rogers
@ 2000-01-29  0:00   ` Bertrand Augereau
  0 siblings, 0 replies; 4+ messages in thread
From: Bertrand Augereau @ 2000-01-29  0:00 UTC (permalink / raw)


Thanks a lot for your answer!

By 'introspection', I meant 'to have methods on a type which return members
and methods of this type'






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

end of thread, other threads:[~2000-01-29  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-28  0:00 Ada features Bertrand Augereau
2000-01-28  0:00 ` Jim Rogers
2000-01-29  0:00   ` Bertrand Augereau
2000-01-28  0:00 ` Tucker Taft

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