Re: What is this?
Re: What is this?
- Subject: Re: What is this?
- From: kai <email@hidden>
- Date: Tue, 1 Mar 2005 23:16:07 +0000
On Tue, 1 Mar 2005 12:44:09 +0000, Nigel Garvey wrote:
Kai wrote on Tue, 1 Mar 2005 01:24:46 +0000:
That's a pretty nifty bunch of examples, Nigel! And you may not even
need that initial integer...
return * ("9.9"'s ninth line)
"" - (some record of "1984")
Hi, Kai. I think you've found yet another anomaly! It seems that in OS
X,
empty strings spaces, line feeds, and returns can be coerced to the
integer 0! (In OS's 9.2.2 and 8.6, this is only possible with empty
strings.)
Right. My guess is that an algorithm has been introduced in OS X to
clean up white space (thus isolating only visible text) before
attempting a text-to-number coercion. For example, this snippet works
in both OS 9 and OS X:
---------
"1" * "1"
--> 1
---------
However, this works only in OS X:
---------
"1 " * "1" (* there's a space after the first "1" *)
--> 1
---------
In OS 9, an error occurs: "Can't make \"1 \" into a number." [error
number -1700: errAECoercionFail - bad parameter data or unable to
coerce the data supplied]
So I imagine that, where a string contains *only* white space in OS X,
the cleaned up version (i.e. an empty string) is actually presented for
coercion - thus allowing this to work:
---------
(return & (ASCII character 10) & space & tab) * (second list of "2")
---------
[snip]
In view of Doug's and Kai's posts and something else I've just tried,
perhaps the bug specification above should be refined to:
[integer or item that can be coerced thereto] ¬
[dual-class math operator] ¬
[reference to non-existent item, consisting of ¬
[singular, plural, or numbered class, property, or constant] ¬
of [numeric string or actual number]]
Phew, Nigel! Sometimes life sure do get complicated... :-)
---
kai
_______________________________________________
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