TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

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

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

Print Reply
Subject:
From:
Maxim Reznik <[log in to unmask]>
Reply To:
Maxim Reznik <[log in to unmask]>
Date:
Tue, 21 May 2002 09:18:39 +0300
Content-Type:
text/plain
Parts/Attachments:
text/plain (31 lines)
Randy Brukardt wrote:
[skip]

>
> 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

ATOM RSS1 RSS2