TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

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

Print Reply
Content-Type: text/plain; charset=us-ascii; format=flowed
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
From: Maxim Reznik <[log in to unmask]>
Date: Tue, 21 May 2002 09:18:39 +0300
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
Reply-To: Maxim Reznik <[log in to unmask]>
Parts/Attachments: 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