comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: question on using `with` without  `use` and visibility of operators such as '*'
Date: Mon, 30 Jul 2012 08:50:22 +0200
Date: 2012-07-30T08:50:22+02:00	[thread overview]
Message-ID: <87fw89bv4h.fsf@ludovic-brenta.org> (raw)
In-Reply-To: jv585h$9tj$1@speranza.aioe.org

Nasser M. Abbasi writes on comp.lang.ada:
> This is annoying. It means I have now to `use package_foo` to be able
> to write x*y, since "*" is defined in the package.
>
> Is there a way around this, so I can avoid using `use` but still be
> able to just write x * y (may be use something like `use
> package_foo("*") at the top if this possible)

package P is
   type T is private;
   function "*" (Left, Right : in T) return T;
end P;

wth P;
procedure Proc is
   Foo, Bar : P.T;
   use type P.T; -- <-- watch this!
   Baz : constant P.T := Foo * Bar; -- P."*" is now directly visible
begin
   null;
end Proc;

-- 
Ludovic Brenta.



      parent reply	other threads:[~2012-08-07  5:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30  6:04 question on using `with` without `use` and visibility of operators such as '*' Nasser M. Abbasi
2012-07-30  6:30 ` Niklas Holsti
2012-07-30  6:33 ` Dmitry A. Kazakov
2012-07-30  6:50 ` Ludovic Brenta [this message]
replies disabled

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