Re: communicating the name of a function to deep within the call tree



glen herrmannsfeldt wrote:
James Giles wrote:
....
This is
clearly the result Phillip Helbig wants (with or without
clothes). If you redeclare the primaries within long_expression
this expression produces the correct result for whatever
new type and KIND of that expression. And it remains
legibly correct.

That is a good reason for writing it that way. Still, there is
the algebra tradition of writing coefficients first. Also,
it separates parts of two thirds, unless it really isn't two thirds.

I don't consider that to be as important as the ability to write
expressions that are generic with respect to their operands.
If Fortran had RATIONAL as a data type, and had Common
Lisp's rule of mixed-mode operation, we could both have
what we want:

(2/3)*(long_expression) ! doesn't work in Fortran

Short of that however, if I want to write code defensively
so that future changes of type and precision are easy, I need
to use what capabilities the language has. Further, we may
eventually have real generic programming features in
Fortran. If you insist on a style that requires syntactic
changes to expressions within the code when the types
of the dummy arguments change, that pretty much destroys
generic programming.

--
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: templates - generic programming
    ... > Is there a preprocessor type of tool available that is sophisticated ... "a preprocessor for Fortran 90 code, ... Generic programming in Fortran 90 ...
    (comp.lang.fortran)
  • Re: Parametric Fortran
    ... > paper describes a code generator for Fortran using Haskell, ... applications of generic programming that I had not encountered before. ... as i described them in a Fortran Forum article some years back). ...
    (comp.lang.fortran)
  • Re: F08 support of floating decimal?
    ... base 3 floating point is also rare. ... Legal for Fortran, though. ... trinary (where the digits are zero, one, and minus one) ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)
  • Parametric Fortran
    ... Thanks to Mr. Giles for presenting his ideas on generic programming in ... paper describes a code generator for Fortran using Haskell, ... Parametric Fortran - A Program Generator for Customized Generic Fortran ... can produce extensions of Fortran that are specialized to support the ...
    (comp.lang.fortran)
  • Re: C style compound assignment operators
    ... In C and C++ they are either prefix or postfix, ... Remember that Fortran has a source form in which spaces ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)