Re: Coercing a list to string (nasty behaviour IMHO)
Re: Coercing a list to string (nasty behaviour IMHO)
- Subject: Re: Coercing a list to string (nasty behaviour IMHO)
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 18 Aug 2001 18:02:43 -0700
On 8/18/01 5:37 PM, "Timothy Bates" <email@hidden> wrote:
>
Axel noted some weird list-->string behaviour
>
>
I replicate it here
>
>
-- Define a sample record.
>
set Dte to {day:1, month:3, year:2000}
>
>
--demonstrate normal behaviour
>
{1, 3, 2000} as string
>
-->"132000"
>
>
--extend normal behaviour to 1 item of record
>
{day of Dte} as string
>
-->1
>
Actually "1".
>
--replicate Axcels nasty bug!
>
{day of Dte, Dte's month, Dte's year} as string
>
-->""
>
{get (day of Dte), get (Dte's month), get (Dte's year)} as string
--> "132000"
{(day of Dte) as number, (Dte's month) as number, (Dte's year) as number} as
string
--> "132000"
(get {(day of Dte), (Dte's month), (Dte's year)}) as string
--> "132000"
Dte as list as string
--> "132000"
So there are a lot of ways of doing it. I can't figure out what the bad
logic is that produces {} or "" or 0 or, more probably 'null', when you
don't evaluate with 'get' or specify each item's data type.
--
Paul Berkowitz