Re: Strange behavior using a module which uses another module



Paul van Delst wrote:
....
How would some sort of "automatic" method that you want be less prone
to error?

I agree with pretty much everything PvD says except (sort of)
this last. In one case that deltaquattro mentioned, I think he's
got a very good point: there should be a way, when you USE
one module inside another to explicitly declare that you don't
want to "trans-ship" the contents any further. His proposed
syntax isn't bad:

USE mod1, (private|public) [rename-list]
or
USE mod1, (private|public), only: only-list

Where, the latter case, the ONLY and PRIVATE/PUBLIC keywords
can appear in either order. Of course, I always have an ONLY, so
the first I would still consider bad style. You make a constraint
that the PRIVATE/PUBLIC keyword here can only be used if the USE
statement is in the specification-part of a MODULE. Only one of
PRIVATE or PUBLIC can appear, not both.

This would be a useful additional control and *could* help
make programs less prone to error. I agree though that PRIVATE
should always be the default for MODULEs and making something
PUBLIC should always be explicit.

--
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


.