Re: he's ranting again (Was: Re: Month as Integer (or he's ranting again))
Re: he's ranting again (Was: Re: Month as Integer (or he's ranting again))
- Subject: Re: he's ranting again (Was: Re: Month as Integer (or he's ranting again))
- From: Chris Nebel <email@hidden>
- Date: Tue, 05 Dec 2000 11:58:05 -0800
- Organization: Apple Computer, Inc.
Emmanuel wrote:
>
At 16:31 +0100 3/12/00, Richard 23 wrote:
>
>Since I can set [snip] PI to 5141.3 and it sticks, they don't seem like
>
>constants to me!
>
>
I'm finding this discussion to be fascinating!
>
>
I remember that in Fortran you could run something like:
>
>
---------- untested
>
EQUIVALENCE 2,X
>
X = 2.01
>
-------------------
>
>
and that subsequent calls to the constant "2" would always use the modified
>
value.
The problem was that FORTRAN (at least the older versions) was defined to
always pass function parameters by reference. That meant that it you passed a
constant, say 5, the compiler had to put 5 in a table somewhere so it would
have a memory location to reference. If the called function then changed its
parameter, the value in the table would be changed, so then subsequent calls
would wind up calling the function with something other than 5. I'm pretty
sure this was not considered a feature!
>
I did not imagine at these times that 20 years later I would make a living
>
with a language where you can never be sure what "pi" evaluates to.
>
>
Apple used to comply rather strictly to the IEEE recommandations. Isn't
>
there one of those which states the value of pi ?
Of course there is, and of course it does. The catch is that "pi" in
AppleScript isn't a constant, it's a property of the AppleScript object.
AppleScript doesn't enforce read-only access to said property, so it's
possible to change the value of pi. This isn't as terrible as you might
think, because it's difficult to do this accidentally, unlike FORTRAN, and
every AppleScript connection has its own copy, so someone else can't change
your pi; you have to do it yourself. Still, it probably shouldn't be allowed.
--Chris Nebel
AppleScript Enginerring