comp.lang.ada
 help / color / mirror / Atom feed
* question on using `with` without  `use` and visibility of operators such as '*'
@ 2012-07-30  6:04 Nasser M. Abbasi
  2012-07-30  6:30 ` Niklas Holsti
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nasser M. Abbasi @ 2012-07-30  6:04 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-07 12:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox