Re: Can someone explain this?
Re: Can someone explain this?
- Subject: Re: Can someone explain this?
- From: "Mark J. Reed" <email@hidden>
- Date: Sat, 14 Mar 2009 16:33:23 -0400
Historically, at least, some lexical analyzers have included leading
signs in the definition of numeric literal tokens. In such systems,
evaluating "-3^2" would yield 9, but setting a variable x to 3 and
evaluating "-x^2" might well yield -9. This discrepancy is why it's
generally considered bad practice to include leading signs in numeric
literal tokens. :).
(And no, that's not what AS is doing, btw; "set x to 3" followed by
"-x^2" also yields positive 9.0)
If I understand your point, your argument seems to boil down to the
fact that "1 through the end" is never a valid range. Certainly
there's a limited set of places where you can insert "the" - it's
somewhat analogous to extra whitespace in languages with a more
traditional syntax. If that is one of the places you cannot, then the
only question is if that's intentional, or at least expected, and as
you said, that's best left up to the engineers at Apple. But it seems
to me that making "end" and "the end" distinct - anywhere - introduces
confusion and dilutes the point of "the"'s inclusion in the language.
On 3/14/09, Deivy Marck Petrescu <email@hidden> wrote:
>
> On Mar 14, 2009, at 1:41 PM, Mark J. Reed wrote:
>
>> On Sat, Mar 14, 2009 at 11:02 AM, Deivy Marck Petrescu
>> <email@hidden> wrote:
>>> It is the same as saying that in AS
>>>
>>> -3^2
>>> --> 9.0
>>>
>>> is a bug.
>>
>> No, it's not. Yes, it's a precedence issue, since there is a parsing
>> conflict between "(start through end) of list" and "start through (end
>> of list)", and that sort of thing is to be expected. But the bug is
>> that the presence of "the" (which should be a no-op) changes the
>> resolution of that conflict!
>>
>> So a better comparison would be if -3^2 was +9, but ---3^2 was -9.
>>
>> --
>> Mark J. Reed <email@hidden>
>
> I understand both yours and Philips point.
> I still do not believe it is a bug, or if it is , it is a much worse
> bug than you are claiming... :)
>
> There has been some changes since we move to X.
> I use "get" all the time now, whereas I do not remember *ever* using
> it in 9 and earlier versions.
> Currently I've noticed that I get some errors if I do not write
> (current date) instead of current date ( no parenthesis).
>
> So, when the compiler sees (does it?) items x thru end, it
> interprets end as being part of the "a thru b" call.
> On the other hand, when you write items x thru the ..., the compiler
> sees "the" and tries to compile that before the "a thru ..."
> I see the logic. The best people to decide are the Apple engineers,
> they will reply back saying whether or not it is a bug or an
> enhancement.
> :)
>
> By the way, -3^2 should return a -9.
> But it could depend on how the software carries out the unary operation.
> And Doug, I am positively sure that you learned that -3^2 is -9.
>
>
> Deivy Petrescu
> email@hidden
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
--
Sent from my mobile device
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden