TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Proportional Font
Show Text Part by Default
Condense Mail Headers

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

Print Reply
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
X-To: Tucker Taft <[log in to unmask]>
Date: Thu, 16 Jul 1998 10:40:48 -0400
Reply-To: Steven Deller <[log in to unmask]>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"
From: Steven Deller <[log in to unmask]>
Parts/Attachments: text/plain (30 lines)
Thanks Tucker for the clarification.  I too almost got into the mode of
thinking that if GNAT accepts it, it must be right.  I should know better
... sigh.

Apex also rejects (properly) the original code, since only if Left and
Right were Boolean would Standard.And apply.

Another approach that works is to use a child package to define the new
functions and refer back to the parent package definition of "and".

package Some_Package is
    type Private_Type is private;
    type Private_Type is array (0 .. 1023) of Boolean;
end Some_Package;

package Some_Package.Sub_Function is
    function "and" (Left, Right : Private_Type) return Private_Type;
end Some_Package.Sub_Function;

package body Some_Package.Sub_Function is
    function "and" (Left, Right : Private_Type) return Private_Type is
        return Some_Package."and" (Left, Right);
    end "and";
end Some_Package.Sub_Function;