Monday, 8-DEC-1997 16:46:13.16
> From: SMTP%"[log in to unmask]" 8-DEC-1997 16:10:53.24
>
> I want to construct my modules (at least some of them) such that modules
> USE'ed within them are invisible outside the module. I'll illustrate the
> problem with a simple example. We define the modules A and B, where B
> depends on A by USE'association. Something like:
>
> module A
> .
> .
> end module A
>
> module B
> use A
> .
> .
> end module B
>
> The behavior I would like is that when USEing B I only have access to the
> public enteties of B and none of the enteties of A ( private or public ). In
> the case I need something from module A I would have to USE A and it would
> not be sufficient to USE B.
This is similar to a discussion I had recently, except that I preferred
it the other way around, and was wondering if this behaviour is
platform-independent (it should be according to the standard). I tend
to prefer the behaviour like it is, as long as it is not FORBIDDEN to
access a MODULE doubly (it's not) though I see your point. If you just
want a few thing from A, then USE A, ONLY: is what you need (B can still
USE what it wants of A). If you want to exclude a few things, then use
the M&R trick USE A, EXCEPT_THIS = > FOO, EXCEPT_THAT => BAR (and of
course don't use the variables EXCEPT_THIS and EXCEPT_THAT in your
code). However, there are intermediate cases where one must include a
lot of typing to get the desired effect.
I'm not sure if the exclusion will work if A is USEd through B, although
it would be nice if it did. Comments?
It seems a lot of people would like PRIVATE to be the default, to have a
READONLY attribute for MODULE variables, and to disallow the implicit
USE (through another module) as you suggested. At first and even second
thought, I tend to agree, as I do with the suggestion of having IMPLICIT
NONE to be the default (at least for free-form source:) (those who don't
want it, and there might be some arguments which aren't all bad, can
have a compiler switch or have their editor include the line
IMPLICIT REAL (A-H), (O-Z), INTEGER (I-N)).
Comments on these four suggestions as to why NOT to do them (I assume
the reasons TO do them are obvious) and reasons, if any, why it is
forever to late to change the default behaviour?
Phillip (donning flame-proof suit:)
--
Phillip Helbig Email .......... [log in to unmask]
Nuffield Radio Astronomy Laboratories Tel. ..... +44 1477 571 321 (ext. 297)
Jodrell Bank Fax ................. +44 1477 571 618
Macclesfield Telex ................. 36149 JODREL G
UK-Cheshire SK11 9DL Web .... http://www.jb.man.ac.uk/~pjh/
My opinions are not necessarily those of NRAL or the University of Manchester.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|