From: Jim Weirich Date: 2002-07-17T14:38:11+09:00 Subject: Re: OT: FORTRAN (Was Re: TkText no -textvariable workaround?) >>>>> "Hal" == Hal E Fulton writes: Hal> I think all or most compilers allowed this Hal> once upon a time. Hal> Actually, I think this was so long ago it was not Hal> considered a bug. Probably not even a feature. Hal> More of a why-would-you-do-that-anyway. As I recall, it is because FORTRAN traditionally used pass-by-reference semantics for passing variables to subroutines. This allowed you to write ... SUBROUTINE SET2(IVAR) IVAR = 2 RETURN END And use it like this ... CALL SET2(J) To set the variable J to the value 2. Unscrupulous programmers could also do ... CALL SET2(1) Since the constant 1 was often stored in a particular memory location, this would change the value stored at that location, so later references to the literal 1 would really be the value 2. Not all compilers had this (mis)feature, but it was a common artifact of a fairly traditional FORTRAN implementation. This reminds me of the ability in FORTH to define words (i.e. subroutines to non-FORTHers) named with a literal number. The number 1 was often defined as a word that pushes a literal 1 on the stack (word references take a single cell while literals take two cells in a tradition threaded code FORTH implementation). That meant you could do things like this ... : 2 1 ; ( Define a word named "2" that returns the value 1 ) Of course, just because you could do that, doesn't mean you should. -- -- Jim Weirich jweirich@one.net http://w3.one.net/~jweirich --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)