Dr W.W. Schulz <[log in to unmask]> wrote:
>I agree with the last statement, but without getting rid of implicit types
>this would become again a fudged syntax part in Fortran:
>
> function foo( x )
> real x
> ...
> end function foo
>
>would need parentheses when called while
>
> function foo( x )
> real x
> real foo
> ...
> end function foo
>
> would not. Such rules are just bloating the standard and confusing to
> most Fortran users. [...]
Both the above would need parenthesis since both require an argument.
The following would not:
function foo
real foo
...
end function foo
A reference to this would not need parenthesis. Indeed, this cleans
up a peculiarity of Fortran syntax (empty parenthesis). No other
class of agrumentless object needs empty parenthesis. A scalar
doesn't need them. A subroutine which takes no arguments
doesn't need parenthesis. Indeed, I'd like to see empty parenthesis
made illegal. I agree that we can't make them illegal until IMPLICIT
is gone. But we can take steps along that road.
>[...] Hence I deplore any new syntax
>that does run against such a possible modern Fortran. [...]
But, I'm not recommending any new syntax. I'm just using the existing
syntax with a "different" semantic interpretation. That is:
x = foo()
and
x = foo
will now mean the same thing if foo is an argumentless function with
an explicit interface. This requires no changes at all in syntax. The
second line is already syntactically legal. (Indeed, in terms of formal
specification of the language using denotational semantics, an argumentless
function is *semantically* indistinguishable from a readonly scalar. That's
why I put "different" in quotes above. It doesn't seem different to me.)
--
J. Giles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|