Numbers and truth values

Beliavsky beliavsky at aol.com
Sun Apr 29 09:56:01 EDT 2007


On Apr 28, 4:05 pm, a... at mac.com (Alex Martelli) wrote:
> John Nagle <n... at animats.com> wrote:
>
> >      I'd have to consider that a bug.
>
> >      Some very early FORTRAN compilers allowed you to redefine
> > integer constants:
>
> >       CALL SET(25,99)
> >       WRITE (6,100) 25
> >      100 FORMAT(I6)
>
> >       SUBROUTINE SET(IVAR, INEWVAL)
> >       IVAR = INEWVAL
>
> > would print
>
> >      99
>
> >      It was generally agreed by 1970 or so that this was a bad idea,
> > and was taken out of the language.
>
> It was still perfectly legal in the Fortran 1977 standard for a compiler
> to cause this effect, because the Fortran source you quote has
> *undefined behavior* -- the compiler doesn't have to diagnose this error
> and can cause any effects as a consequence.
>
> The point of Fortran is to let the compiler generate the fastest code it
> can, NOT to "tenderly hold your hand" lest scary bugs disturb your
> blessed and dreamy innocence.

The point of Fortran has been to make scientific programmers more
productive, and catching errors and producing fast programs are BOTH
ways of doing that. Compilers are judged on BOTH criteria:
speed: http://www.polyhedron.com/pb05/linux/f90bench_p4.html
diagnostics: http://www.polyhedron.com/pb05/linux/diagnose.html

If there is a compiler with great compile- and run-time debugging
capability with the right options turned on, and if the compiler also
produces optimally fast code with another set of options (or if
another compiler does this), isn't that the best of both worlds?

> If this has changed in the Fortran 1990 standard or later, then I can
> only say I'm happy I stopped using Fortran heavily before such standards
> became widespread in commonly available compilers -- by the late '90s,
> when I was still using _some_Fortran, it was Fortran '77, as that was
> the version that was widely available and well optimized.

I don't think the official status of such has changed -- it's still
illegal to change a constant and the compiler is still not required to
catch the error -- but compilers may be more likely to reject
such code as before, helping programmers spot errors. IMO that's a
good thing.

When is no longer using a language, one has the luxury of thinking
about it in an ideological rather than practical manner.




More information about the Python-list mailing list