Re: Where to report Script Editor bug?
Re: Where to report Script Editor bug?
- Subject: Re: Where to report Script Editor bug?
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 20 Feb 2004 12:47:16 -0800
OK. When I try it in a regular script window in Script Debugger, I get "0".
But when I try it (as I did last time) in the Console window of Script
Debugger, I get
set myConvertedTemp to (32 as degrees Fahrenheit) as degrees Celsius
get myConvertedTemp as string
-->" 0e+0"
That implies to me that there's an extra coercion going on in some contexts
and not in others.
In any case, if 'degrees Celsius to string' is not documented as an
implemented coercion, and it's certainly not anywhere I know, the IT'S NOT A
BUG IF IT DOESN'T DO THE COERCION. What 3rd-party editors, etc. do doesn't
matter. Maybe even one or other Script Editor does the coercion under
certain conditions - it certainly looks as if something odd is going on. But
if it's not a documented coercion, then there's no bug. Maybe a missing
desired feature, OK. Just go via as real and you get what you're looking
for.
It's handy that 'degrees Celsius' and 'degrees Fahrenheit' exist as classes
for conversion purposes. I don't get where you expect to be able to coerce
them to string. Be grateful that they coerce to real, and use that.
--
Paul Berkowitz
>
From: Richard Rvnnbdck <email@hidden>
>
Date: Fri, 20 Feb 2004 20:37:48 +0100
>
To: AppleScript <email@hidden>
>
Subject: Re: Where to report Script Editor bug?
>
>
Paul,
>
>
Thanks for your suggestion, but as I said: When I run it in from any other
>
environment, Script Debbuger, the Script Menu, Smile, as application, Script
>
Editor 1.9 etc. it DOES coerce to string
>
>
It is ONLY the Script Editor 2.0 (v43) that returns that result, and only
>
for 32, any other value will coerce.
>
>
I really can't see how that would be expected behavior, to me it really
>
seems like a bug
>
>
>
>
>
On 04-02-20 19.42, "Paul Berkowitz" <email@hidden> wrote:
>
>
> On 2/20/04 10:10 AM, "Richard Rvnnbdck" <email@hidden> wrote:
>
>
>
>> This:
>
>>
>
>> set myConvertedTemp to (32 as degrees Fahrenheit) as degrees Celsius
>
>> get myConvertedTemp as string
>
>>
>
>> will result in:
>
>>
>
>> " 0e+0"
>
>>
>
>> but when run from the Script Editor, but when run from Script Debugger, the
>
>> script menu, or saved as an application, it will return 0
>
>>
>
>> Easy enough to work around, but should probably be reported anyway, so where
>
>> do I do that?
>
>
>
> 1. I get exactly the same result (" 0e+0") in Script Debugger.
>
>
>
> 2. It's not a bug. Who said 'degrees Celsius' was supposed to coerce
>
> directly to string?
>
>
>
> If you do just
>
>
>
> set myConvertedTemp to (32 as degrees Fahrenheit) as degrees Celsius
>
> --> 0.0 degrees Celsius
>
>
>
> You can coerce that to a real or to an integer easily:
>
>
>
> get myConvertedTemp as real
>
> --> 0.0
>
>
>
> get myConvertedTemp as integer
>
> --> 0
>
>
>
> If you're not in Panther, you should stick with 'as real' or else do a div 1
>
> or round operation on the real to get an integer if that's what you want, in
>
> case the real isn't a whole number. (Only in Panther can you coerce reals to
>
> integers if they're not whole numbers ending in .0).
>
>
>
> And then coerce the real or integer to string:
>
>
>
> get myConvertedTemp as real as string
>
> --> "0.0"
>
>
>
> get myConvertedTemp as integer as string
>
> --> "0"
>
>
>
> If not in Panther, I'd do this:
>
>
>
> set myConvertedTemp to (round ((33 as degrees Fahrenheit) as degrees
>
> Celsius as real)) as string
>
> --> "1"
>
>
>
> In Panther, this will also work:
>
>
>
> set myConvertedTemp to ((33 as degrees Fahrenheit) as degrees Celsius as
>
> integer) as string
>
> --> "1"
>
>
>
> There are also ways to get it to 1 or 2 decimal places, as you wish. (You
>
> probably don't want this:
>
>
>
> set myConvertedTemp to ((33 as degrees Fahrenheit) as degrees Celsius as
>
> real) as string
>
> --> "0.555555555556"
>
>
--
>
Richard Rvnnbdck
>
08-444 06 08
>
070-774 06 08
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.