Arrays in Rev (long)

Dar Scott dsc at swcp.com
Sun Jul 11 17:31:23 EDT 2004


On Jul 11, 2004, at 3:16 PM, Ken Ray wrote:

> The first thing you need to "grok" is that the way Rev uses associative
> arrays and making what I call "string assumptions" can allow the 
> arrays to
> mimic true multidimensional arrays, even though under the hood, they 
> are
> considered to be single-dimension string-based arrays.

Cool essay, Ken.

While we are at it I'll mention a couple details concerning arrays.

As Ken mention, the subscript is an expression that is viewed as a 
string.

Here is a gotcha for numeric subscripts.  The subscripts in a[0.0+0.0] 
and a[0.0] do not point to the same entry, because the first use a 
subscript of "0" and the second uses a subscript of "0.0".

Another for array subscripts.  Null cannot be a subscript.

There are some things to watch for in array values.  Array elements 
cannot (yet!) be arrays.  The result of arithmetic retains full 
precision when saved as an element (numberFormat is not applied at 
saving) and is not coerced to a string.  When converted to a string 
later, numberFormat at that time is used.

Dar Scott



More information about the use-livecode mailing list