Arrays in LC [was: Re: [TAO] value() to obtain pointer functionality]

Richard Gaskin ambassador at fourthworld.com
Wed Aug 27 11:59:55 EDT 2014


Bob Sneidar wrote:

 > Come to think of it, Trevor Devore seems to have found a way for
 > numerically indexed arrays to have their keys in order in sqlYoga.
 > Also, when you get the dgData of a data grid, the array is
 > “numerically indexed” by which I mean the keys of the array are
 > numbers, and they are in numerical order. My experience is that the
 > keys of an array are typically randomly ordered but he seems to have
 > found a way to order them.

All keys in associative arrays are strings, and currently LC only 
supports associative arrays.  The string may consist of numerals only, 
but it's still a string.

It would seem that Trevor rebuilds the array on deletes.  It would be 
interesting to hear more about how he does this if he reads this message 
and has time to reply.

Or one of us could dive into the DG code and find it.  Either way, I 
suspect it's iterating over the collection.


 > Good luck getting RunRev to deprecate anything. One of their huge
 > selling points has always been backwards compatibility.

That should be a selling point for any language; there's no value in 
deprecating things willy-nilly just to see if your audience is on their 
toes. :)

Like any other language maintainer not wishing to annoy, RunRev 
deprecates a token or token usage only when there's value in doing so.

For example, "character" as a chunk type used to be synonymous with 
"byte", but they changed this long before introducing Unicode because 
they anticipated a future in which the two may be very different things, 
requiring a new token with "byte" and deprecating the old use of 
"character" as always meaning one byte (in a Unicode world is may be any 
number of bytes, commonly two in LC's UTF-16).

Similarly, "word" has changed its meaning, so that it no longer includes 
multi-word quoted strings (which was a strange decision from the 
HyperCard team faithfully carried over into MC).  In v7 dp10 forward, 
the new token for the old behavior is "segment" - see page 10 of the 
Release Notes:
<http://downloads.livecode.com/livecode/7_0_0/LiveCodeNotes-7_0_0_dp_10.pdf>

Other tokens have been deprecated completely, as in no longer supported 
at all.

For example, "answer programs" was specific to Mac OS 9 and earlier, no 
longer supported by either its maker or RunRev, so that command no 
longer works.

RunRev doesn't deprecate often, and thankfully never takes such a 
decision lightly.  But when there's value in doing so, they will.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list