Re: bug in rest of list?
Re: bug in rest of list?
- Subject: Re: bug in rest of list?
- From: JJ <email@hidden>
- Date: Tue, 05 Feb 2002 21:51:02 +0100
>
I discovered what may be a bug. Consider this code (AS 1.7 with Standard
>
Additions 1.6):
>
>
set x to {"&&&&", "===="}
>
set y to rest of x
>
--> y should be {"===="}
>
>
set z to class of y
>
display dialog z as string
>
--> list (as expected)
>
>
set z to count y
>
display dialog z as string
>
-- > 1 (as expected)
>
>
try
>
display dialog y as integer -- deliberately err
>
on error errmsg
>
display dialog errmsg -- y looks like a string!
>
end try
>
>
Any explanations forthcoming?
Sorry, I'm running AS 1.3.7 but, where is the bug?
>
--> y should be {"===="}
Is it or not? Log window?
>
--> list (as expected)
OK
>
--> 1 (as expected)
OK
>
-- y looks like a string
If you receive the dialog: << Can't convert "====" into a string >>,
then there isn't a bug, but a single string list is coerced to a string
automatically, a list of strings can _be_coerced_ to string, and a list
without records, too.
Try this:
set x to {"Hello!"}
display dialog x
set y to {"Hello, ", "Dolly"}
display dialog y as string
set z to {"Hello, ", "Dolly", {1, 2.25, "k"}}
display dialog z as string
JJ