comp.lang.ada
 help / color / mirror / Atom feed
From: "Nasser M. Abbasi" <nma@12000.org>
Subject: question on using `with` without  `use` and visibility of operators such as '*'
Date: Mon, 30 Jul 2012 01:04:34 -0500
Date: 2012-07-30T01:04:34-05:00	[thread overview]
Message-ID: <jv585h$9tj$1@speranza.aioe.org> (raw)

<warning, newbie in Ada>

I prefer to use the long name of a package when I call some of its
functions. So I like to write

------------------------
with package_foo;
    package_foo.function_name();
-----------------------

rather than

-----------------------
with package_foo; use package_foo;
   function_name();
----------------------

So that when reading the code, I know where things are.

This worked well so far, but when the package happened to export
functions/operators  such as '*' or "+" for the types, then it will
not work any more. i.e. I really want to just write

            x * y

where x,y are variables with types defined in the package, and not write

            x package_foo("*") y

(or whatever the correct syntax would be)

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)

I can provide example if needed. The error I get are of the form

       there is no applicable operator "*" for type .....

This error goes away when I add `use package_foo`

(Ada is so picky !)

thanks,
--Nasser



             reply	other threads:[~2012-08-07  6:07 UTC|newest]

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

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