Re: unicode text coercion to number bug?
Re: unicode text coercion to number bug?
- Subject: Re: unicode text coercion to number bug?
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 14 Sep 2004 00:54:59 -0700
On 9/14/04 12:35 AM, "Richard Morton" <email@hidden> wrote:
> I think Mark got his examples the wrong way around:
>
> (1.2 as Unicode text) / 3 --> 0.4
>
> (1.2 as Unicode text) * 3 --> AppleScript Error. Can't make "1.2" into
> a number.
>
> I get the same result as this under 10.3.3.
Ah, yes. Well, just one of those dumb AppleScript things. If you don't do
silly stuff you won't get surprises. Just use numbers, not text, for all
arithmetic calculations.
>
> Presuming that Mark is not specifically coercing a number to Unicode
> text just to do arithmetic on it, which seems unlikely, it may be worth
> him coercing the text - 'as number' - before numeric operations.
>
> Still, the behaviour above doesn't seem ideal - they should either both
> work or both fail I think.
Suppose so, yes. I think a coercion here is dumb and unnecessary myself.
MUCH better to error and show you you're using improper data types for these
operations.
--
Paul Berkowitz
_______________________________________________
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