Re: unicode text coercion to number bug?
Re: unicode text coercion to number bug?
- Subject: Re: unicode text coercion to number bug?
- From: Christopher Nebel <email@hidden>
- Date: Tue, 14 Sep 2004 17:45:25 -0700
On Sep 14, 2004, at 1:21 PM, Emmanuel wrote:
At 12:10 PM -0700 14/09/04, Mark Butcher wrote:
Several pointed out that you shouldn't rely on automatic coercions
unless you are 100% sure of them. I had tested this with divide, and
it worked, so I assumed it would automatically coerce with multiply
also. My point is that it should either work for _both_ multiply and
divide, or not. My own feeling in this case is that it should not
work. But how can you ever be 100% sure anyway?
As others stated already, the rule as published is that AppleScript
attempts to coerce the right member to the left member's type. I mean
no offense, but your construct does not comply to the rules of
AppleScript. Unless you were really expecting to trigger an error with
"(1.2 as Unicode text) / 3" it is hard to say that you were victim of
a bug.
Ah, that's not really the rule. The "use-the-left-hand-type" rule only
applies for polymorphic operators, notably "&". The math operators are
not polymorphic (at least not in a way that makes a difference), and
have always coerced both operands to numbers.
Mr. Butcher is entirely correct that it at least ought to behave
consistently, and since "(1.2 as string) * 3" produces 3.6 and always
has, the correct fix is to make Unicode text match that. This should
be fixed in a future release.
--Chris Nebel
AppleScript Engineering
_______________________________________________
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