Print

Print


Hargraves Gary writes:

 > Secondly, I would *postulate* (without setting up to test - which
 > you might do) that unless there *was indeed* an ONLY in both
 > Modules B_1 and B_2 of your hypothetical example, *and* the
 > contents of those two were mutually exclusive; the dual usage in
 > Module C would be give errors on compilation.

No.  See Giles' reply.  This does not count as duplicate declaration.
If there is a contradiction (namely if you end up telling it that
a single name represents 2 different things in the same scope),
then you'll have a problem, but this case isn't a contradiction - you
just have two different sources of the same information (that the
name in question is in the original module).

Note that it is ok to end up having 2 names for the same thing
(by rename); the only problem is if one name represents 2 different
things.

If code like yours wasn't allowed, then life would be awkward for
some things.

--
Richard Maine                |  Good judgment comes from experience;
[log in to unmask]       |  experience comes from bad judgment.
                             |        -- Mark Twain