Re: My operator can beat up your operator.
Re: My operator can beat up your operator.
- Subject: Re: My operator can beat up your operator.
- From: email@hidden (Michael Sullivan)
- Date: Tue, 13 May 2003 10:34:27 -0400
- Organization: Business Card Express
>
On Saturday, May 10, 2003, at 02:13 AM, Dennis W. Manasco wrote:
>
>
> At 3:54 pm -0400 5/9/03, Michael Sullivan wrote:
>
>
>
>> It's ridiculous to have the minus have a higher precedence than the
>
>> power operator, because it just gets lost if the power is even.
>
>
>
> I see nothing _ridiculous_ about producing an algebraically and
>
> mathematically correct result.
>
>
Whether you find it intuitive, ridiculous, or otherwise, standard
>
algebraic practice is that exponentiation has higher precedence than
>
negation, so without parentheses, -3^2 comes out to -9, not 9.
>
AppleScript does *not* follow this rule: it considers negation to be a
>
separate operator with higher precedence than exponentiation, so -3^2
>
comes out to 9, not -9. Some other systems, notably Excel, do this.
>
There is a bug filed on this. It's unlikely to ever be fixed in
>
AppleScript 1.x because of backward compatibility concerns. However,
>
some future version that fixed other things that would break backward
>
compatibility might fix this one as well.
I'll add here that I agree completely with this position. In fact, I'd
go so far as to say that it shouldn't be changed unless there's a
version that will break backward compatibility in math code specifically
(not just any break).
I feel the need to do that, since I'm one of the people ranting about
the mistake. My rant is aimed more at the people who think this
behavior is correct than at a need to change it. The cost of breaking
code of people who've depended on this behavior is probably much greater
than the benefit from making it work correctly.
Personally, I'm getting very fond of lisp these days where I get to
ignore operator precedence entirely. Why didn't Dylan become the apple
scripting language, exactly? <sigh>
Michael
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.