Re: Host variable inheritance
- From: "James Giles" <jamesgiles@xxxxxxxxxxxxxxxx>
- Date: Thu, 27 Apr 2006 20:32:38 GMT
Dan Nagle wrote:
Hello,
Joe Krahn wrote:
Here's one more idea to help avoid unexpected bugs in CONTAINed
procedures: How about an INHERIT statement to control the
accessibility of host variables, i.e.:
INHERIT :: a,b,c
or
INHERIT NONE
Maybe something like this is already in the works?
It's been considered, but it never made the threshold.
If more folks were on J3, perhaps it would have.
Or, if more folks were aware that the committee was remotely
interested (though public debate of the possibility) and consequently
made their own support known, the existing members might have
perceived the need more acutely.
--
In any case, I've mentioned the feature many times in this forum.
My present version (in my toy language) is:
IMPORT :: rename-list
If a name isn't on the IMPORT list, you can still access it with
a qualified name:
hostname..entityname
or
_..entityname
The latter form is for case where the contained procedure is
in an INCLUDE file and therefore doesn't necessarily know
the name of the host. Whether that's a good idea or not is
still debatable. After all, how does it know the entity name
either? My rule is: try to figure all variations of a feature
and weed out the overkill later.
This is a special case of the IMPORT statement, which is what
I have instead of USE (mainly because I just get tired of writing
descriptions of Fortran code that have the phrase "then you use USE"
or some such thing).
The Fortran version could be to say
USE, ONLY: rename-list
A USE without a module name would be interpreted as
referring to the host. An empty rename-list would mean
that nothing was inherited by host association - unless Fortran
also chose to allow qualified names.
--
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
.
- Follow-Ups:
- Re: Host variable inheritance
- From: Dan Nagle
- Re: Host variable inheritance
- References:
- Host variable inheritance
- From: Joe Krahn
- Re: Host variable inheritance
- From: Dan Nagle
- Host variable inheritance
- Prev by Date: Re: New style DO syntax?
- Next by Date: Re: New style DO syntax?
- Previous by thread: Re: Host variable inheritance
- Next by thread: Re: Host variable inheritance
- Index(es):
Relevant Pages
|