TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Maxim Reznik <[log in to unmask]>
Tue, 21 May 2002 09:18:39 +0300
text/plain (31 lines)
Randy Brukardt wrote:

> But the *really* best solution is an OOP-based solution. This is extensible
> and type-safe and doesn't require unsafe compares and doesn't even need
> (visible) access types. Admittedly, there is a bit more work up front, but I
> think access types should avoided unless there is really dynamic allocation
> (which can't happen with subprograms in Ada). One of the really nice things
> about Ada 95 is that you can do useful OOP without using any access types.
>               Randy Brukardt.

Could you explain please how to avoid visible access type?
I tought we should write something like

package Subscriber is

    type Listener is abstract tagged null record;
    procedure Action (L : Listener) is abstract;

    type Listener_Ptr is access all Listener'Class;

    procedure Register (P : Listener_Ptr);
    procedure Unregister (P : Listener_Ptr);

end Subscriber;

Maxim Reznik