comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Ada generics and private type operations
Date: Sat, 14 Oct 2006 10:48:28 +0100
Date: 2006-10-14T10:48:28+01:00	[thread overview]
Message-ID: <m2fydrns7n.fsf@grendel.local> (raw)
In-Reply-To: 1160773480.393825.96390@b28g2000cwb.googlegroups.com

"Adam Beneschan" <adam@irvine.com> writes:

> Silly me.  I got so distracted by the presence of bird tracks all over
> my source that I forgot: you *can't* say ">=" => ">=" five times in
> your instantiation, because the thing on the left of the => can't be
> ambiguous.
>
> In fact, if you have more than one "with function >=" in your generic
> formal, then you can't say ">=" => anything, even once.  Either you
> have to let all of them default, or you have to use positional notation
> when you're instantiating (12.3(9)).  Actually, it's occurred to me
> that maybe this was your problem?

This is possibly a case for generic signature packages.

   generic
      type T is private;
      with function ">=" (L, R : T) return Boolean is <>;
   package Type_Signature is end Type_Signature;

   with Type_Signature;
   generic
      with package A is new Type_Signature (<>);
      with package B is new Type_Signature (<>);
   package User is
      function "<" (L, R : A.T) return Boolean;
   end User;

   package body User is
      function "<" (L, R : A.T) return Boolean is
      begin
         return not A.">=" (L, R);
      end "<";
   end User;



  reply	other threads:[~2006-10-14  9:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.0.1160709703.4389.comp.lang.ada@ada-france.org>
2006-10-13  4:34 ` Ada generics and private type operations Jeffrey R. Carter
     [not found]   ` <mailman.1.1160744826.4389.comp.lang.ada@ada-france.org>
2006-10-13 20:39     ` Adam Beneschan
2006-10-13 21:04       ` Adam Beneschan
2006-10-14  9:48         ` Simon Wright [this message]
2006-10-13 21:08     ` Jeffrey R. Carter
2006-10-14  7:46 ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox