Delete an Array Entry?
Dave
dave at looktowindward.com
Thu Mar 1 13:05:55 EST 2007
On 1 Mar 2007, at 16:17, Richard Gaskin wrote:
> Dave wrote:
>>>> delete global myArray[17]
>> does not delete the 17th element, unless the key "17" just happens
>> to the 17th element. The documentation is confusing on this
>> point. Also the whole name "Array" for this datatype is
>> confusing, a better name would be "table", since it doesn't
>> behave like an array at all.
>
> It behaves perfectly well as the associative array it is.
True, but address the 17th element makes no sense in this case, since
you are not actually address element 17, but rather the element whose
key is "17".
> True, most programming languages focus on numerically indexed
> arrays, so unless you're familiar with associative arrays Rev's
> implementation can be confusing at first.
I've used them in other languages for ages. In particular SNOBOL4 and
SPTOBOL, there they are called "tables" and therefore are confusing
to understand.
When I read the part quoted above in the documentation I thought for
a moment that myArray[17] was some special usage and wasted times
checking that it worked the way I thought it worked. There is really
no point in describing the RunRev type of Array in these terms since
there is no element 17 or any other numeric index. Whoever wrote the
documentation didn't understand how Arrays in RunRev work. If they
had been called something less confusing then the problem would not
have arisen and I wouldn't have wasted time! That's my main point.
All the Best
Dave
More information about the use-livecode
mailing list