Re: Strange behavior using a module which uses another module



glen herrmannsfeldt wrote:
Jugoslav Dujic wrote:
(snip)

A "symbol" is a name for, generally, an object (variable, function,
parameter...). Since one name can be used only for one object within
the same scope, USEing C "twice" just "reaffirms" that symbols from
module C refer to objects from module C :-).

Well, for an automatic variable in a recursive routine,
the same symbol is used for different objects at different
recursion levels.

But we are talking about MODULE variables which aren't
automatic. And you can't recursively invoke a MODULE.
In fact, you can't invoke one at all. USE has entirely different
semantics than invocation.

A symbol might also be a type name, in which case it may
be used for more than one object of that type, within
the same scope. Some languages allow multiple declarations
as long as they are consistent, others do not.

But again, we're not talking about multiple declarations, just
multiple USE. USE declares nothing. (Well, OK: renames
can possibly be considered declarations. I don't know if
you're allowed to do the same rename multiple times or not.
Obviously conflicting renames in the same scope would
be a problem.) USE certainly doesn't declare any of the
MODULE entities no matter how many time you USE the MODULE.
The declaration of MODULE entities is done in the MODULE.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare

"Simplicity is prerequisite for reliability" -- E. W. Dijkstra


.