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
Steven Deller <[log in to unmask]>
Thu, 16 Jul 1998 10:40:48 -0400
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;