Re: Host variable inheritance



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


.



Relevant Pages

  • Re: Host variable inheritance
    ... How about an INHERIT statement to control the ... I've mentioned the feature many times in this forum. ... the name of the host. ... descriptions of Fortran code that have the phrase "then you use USE" ...
    (comp.lang.fortran)
  • Re: Host variable inheritance
    ... Joost wrote: ... 'import' or 'inheritance' of variables from the host. ... I'm the opposite way round - most of my internal procedures are chunks of code pulled verbatim from horrendously long and complicated old routines, so that the underlying structure is exposed. ... I need to inherit everything in there - but I'd love to be able to write INHERIT ALL so that the next person who looks at the code can see that's what's intended to be going on. ...
    (comp.lang.fortran)
  • Re: Public disclosure of discovered vulnerabilities
    ... > It doesn't do anything Fortran, Pascal, Modula, PL/I, or a host of other ... Not to mention all those Algol-like system languages ... Fortran 4 and 77 cannot handle interrupts or recursion. ...
    (sci.crypt)