Re: Statement function host association



"James Giles" <jamesgiles@xxxxxxxxxxxxxxxx> writes:

> Richard Maine wrote:
> ...
>> What the cited material is about is this. Given (from the rules
>> elsewhere on host association) that you have an implicitly typed
>> variable "shared" by host association, which scoping unit does it
>> get its implicit typing from (since the implicit typing rules can be
>> different in different scoping units)? The answer is the
>> "outermost", "highest level", or whatever term is best. (And there
>> always will be a unique highest level one).
>
> The answer is not the "outermost" or the "highest level". It turns
> out that the answer is *always* the "most local", "innermost", or
> whatever term is best. No, that's not true either. It turns out that
> there are no choices at all - there is only *one* possible scope to
> choose from (as per the discussion with, and references cited by,
> JvB). There should be no adjective used in describing the scoping
> unit at all.

Sorry, but I'm going to disagree with you again.

I'm not inclined at the moment to go tracing through citations or to
argue fine points of how it should or should not have been worded, or
whether the words are entirely consistent (they aren't). For example,
if you are making a fine distinction based on saying that host
association is association of 2 different entities instead of being
one shared entity, then that's a subtlety I'll not bother to argue
(and I strongly suspect that the standard is inconsistent in its
wording on that matter).

I'll stick to Fortran instead of English

program maine
j = 7
call inner
write (*,*) j
contains
subroutine inner
implicit character(j)
j = 42
write (*,*) j
end subroutine inner
end program maine

I haven't bothered to try it. But that's partly because I am
unreasonably confident that I know what it will do (possible typos
excepted). And don't have a Fortran compiler handy on this machine
anyway - suppose I ought to download a copy of g95 to fix that.

It will print out 42 (integer) twice. The J in the internal subroutine
will be implicitly typed as integer and will be host associated (or
shared, or whatever you want to call it) with the J in the main
program. The implicit statement in the internal procedure has no
interesting effect here. And the j=42 in the subroutine will end
up changing the value of the J in the main program.

I am perhaps recklessly confident that every compiler you try this
on will interpret it the same way as I did. So if you think that
the standard means something different, you'll have a lot of vendors
to convince otherwise.

If you are just arguing that the standard doesn't say it correctly,
then I'll drop the whole thing. Maybe you are right; that's not
something I'm interested in debating at the moment.

Or maybe you'll just find that I'm completely wrong in my confidence.
It has happened before.

--
Richard Maine
email: my last name at domain
domain: summertriangle dot net
.



Relevant Pages

  • Re: Fortran refactoring
    ... All of the codes I'm working with DO have implicit none, ... run across this particular wrinkle. ... Richard Maine wrote: ...
    (comp.lang.fortran)
  • Re: Host variable inheritance
    ... 'import' or 'inheritance' of variables from the host. ... I don't care about the syntax, even IMPLICIT ...
    (comp.lang.fortran)