Apparently empty arrays

Dar Scott dsc at swcp.com
Fri Mar 26 22:34:51 EST 2004


On Friday, March 26, 2004, at 08:05 PM, J. Landman Gay wrote:

> I have a question about this:
>
> put "a" into myArray[1]
> put "b" into myArray[2]
>
> put myArray is empty --> true
>
> Shouldn't that be false? I'm not sure. I know an array has always 
> returned empty when you don't specify one of its elements, but today 
> that sounds wrong to me.

Maybe if
    myArray is empty
is read as
    myArray = ""
this would seem better.

Maybe not.

Maybe new operators like 'is an array' or 'the number of elements of' 
would help.

I think it would be cool if all values (including arrays in my world) 
were virtually strings with some magic going on underneath so that the 
performance hit is light.  In this alternate universe there is a string 
representation for every array and when needed it is generated as the 
value of the array.

Currently, we have to use the keys to see if an array is empty, uh, I 
mean if it has no elements.

Dar Scott



More information about the use-livecode mailing list