Re: character of a string which is a number.
Re: character of a string which is a number.
- Subject: Re: character of a string which is a number.
- From: "Nigel Garvey" <email@hidden>
- Date: Tue, 11 Oct 2005 14:58:27 +0100
Emmanuel wrote on Mon, 10 Oct 2005 23:06:07 +0200:
>Under 10.3.9 - results under 10.4.2 welcome.
>
>Perplexing enough, what would you expect that line to return:
>
>0 + (character 50000 of "1234")
>
>It's a complex issue, where AppleScript has both to deal with a
>so-far reference (character 5) and to coerce to number. What will it
>do first?
>
>It eventually coerces to number ... the partial result of the failing
>evaluation, "1234", and kindly returns:
>
>-- 1234.0
An interesting one. The result's the same in Jaguar and Tiger.
Presumably, the first call is to coerce the reference to number (to
integer, if possible, to match the 0), which occasions the unsuccessful
excursion to resolve the reference first. Some misunderstanding of the
error on the way back results in a real. No addition appears to take
place. Any rubbish reference will have the same effect, but the string
must be coercible to number. It can even _be_ a number:
7 + (middle Wednesday of 1234)
--> 1234.0
There are other interesting effects if you change the math operator.
Things error as expected if the reference is handled before any thought
about the arithmetic:
(character 50000 of "1234") + 0
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden