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
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
From: "W. Wesley Groleau x4923" <[log in to unmask]>
Date: Wed, 9 Dec 1998 13:40:31 -0500
Reply-To: "W. Wesley Groleau x4923" <[log in to unmask]>
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:

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