TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show HTML 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:
"W. Wesley Groleau x4923" <[log in to unmask]>
Reply To:
W. Wesley Groleau x4923
Date:
Wed, 9 Dec 1998 13:40:31 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (30 lines)
Re: Richard Riehle's excellent suggestion:
>       generic
>         type Item is private;
>         with function Tic_First          return Item;
        [ with function Tic_Image (I:Item) return String; ]
>         ...
>       package Generic_Math_Ops is ...
>
>   If you do instantiate with a type for which there is a set of predefined
>   operators, the use of the default reduces the number of actual arguments.

This would be even easier if "Ada-2K" is enhanced to allow

   first, attributes to be truly equal to subprograms:

      package Mine is new Generic_Math_Ops
                          (Item      => Wierd_Type,
                           Tic_First => Wierd_Type'First,
                           ....

   second, generic formals to define defaults that don't match the
   formal names:

       generic
         type Item is private;
         with function Tic_First          return Item is Item'First;
         with function Tic_Image (I:Item) return String is Item'Image;
         ...
       package Generic_Math_Ops is ...

ATOM RSS1 RSS2