Re: overloaded cant be distinguished by return values?



Reinhold Bader wrote:

Richard Edgar wrote:

Being more general (please correct me if I'm wrong...), this is an
example of the rule in Fortran that the RHS of any expression is
evaluated before the LHS is considered.

If I've understood it correctly, it is simply a case of a function
result not being a dummy argument, although in some respects it may
behave similar to one with intent(out). In particular, the function
result object is short lived in that it ceases being defined once the
assignment to the LHS at call is performed.

The function result is converted to the type needed in the expression
where the function is called. It is a one way path from the function
result type to the expression and not the other way around.

In some cases the function call is implemented by passing an additional
argument to the function, such that the return value is stored in
that argument. The passed argument corresponds to the known function
return type, not the other way around.

It might be possible to define a language that did function
calls differently, but that is not Fortran nor any of the other
popular languages. There are many cases where the function
return type is not known in the way needed to resolve
generic function calls.

-- glen

.



Relevant Pages

  • Re: Floating point equality comparison if(a==0)
    ... > experimentally, rather than using Fortran intrinsics such as TINY, ... Obviously I dont expect that any computation involving "a" on the LHS will ... I could use the additional logical flag, ... cumbersome and I would prefer to avoid it if possible. ...
    (comp.lang.fortran)
  • Re: Why index starts in C from 0 and not 1
    ... > The most popular languages at the time C was designed used 1-based ... > indexing: FORTRAN, BASIC, Pascal. ... Quibble: Pascal allows arrays to be based however the user specifies. ...
    (comp.lang.c)
  • Re: overloaded cant be distinguished by return values?
    ... Richard Edgar wrote: ... example of the rule in Fortran that the RHS of any expression is ... assignment to the LHS at call is performed. ...
    (comp.lang.fortran)