From: "Bill Long" <[log in to unmask]>
Sent: Saturday, June 03, 2017 1:48 AM
> Maybe I missed something in the noise here, but I’m having trouble seeing the issue.
>
> The desire to make CMPLX generic is moot. CMPLX is already generic.
Yes and no.
> It will accept arguments that are complex, real, integer, or even boz constants.
But it does not return a result that is of the same kind as its principal argument.
Think of SIN. It returns a result of the same kind as its argument.
Give it double precision argument, and it returns a double precision result.
Give it a default precision argument and it returns a default precision result.
CMPLX should do the same.
It currently traps everybody, even professionals, because what it does is unexpected
and inconsistent with other generic functions.
> The KEY point is that CMPLX is a type conversion function. Just like REAL. If I code REAL(x) I
> expect the result to be default REAL with the value of x, as close as conversion allows. In other
> words, convert X to type default REAL. If I code REAL(x, 8) then I expect the result to be REAL
> with KIND=8. Same pattern for INT. And for CMPLX.
>
> The argument for a compiler option to change the interpretation of CMPX to something else that is
> incompatible with the standard seems equivalent to “I didn’t pay attention in my programming
> class, or had a bad teacher/textbook, and I don’t want to learn real Fortran but rather what to
> keep making my old mistakes over and over again”. It seems a request like that would get little
> interest from a compiler vendor.
>
> But the discussion does raise the point that better teaching of Fortran programming
and maybe more/better textbooks might be a good idea.
Better teaching of professionals is irrelevant.
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
|