Array keys oddity?

Bernard Devlin bdrunrev at gmail.com
Mon Jun 8 03:46:35 EDT 2009


Maybe sockDrawWhereNoTwoLeftSocksAreTheSame would be even better :-)

Although now we would also have to say
sockDrawWhereNoTwoLeftSocksAreTheSameAndWherePairsOfSocksCanContainOtherPairs.

Do socks really come in left and right versions?  I'm always so groggy
before my coffee I've never bothered to look at socks that closely.
Maybe I've been putting the left sock on my right foot.

I think that some programming languages may have sub-types of
dictionaries where the keys are in a stable order.  However, the
reason for them being unordered by default is for speed (there's no
need to re-structure the dictionary when 40001 is inserted between
40000 and 40002).

And I suppose in English the word "array" does not have the precise
connotations that it has in programming languages.  And as we've seen,
arrays in Rev behave unlike the way most programmers would expect them
to behave.  It's just a general problem of finding terms from the
ordinary world that fit the extraordinary world of programming.

I know of newbies who have trouble understanding why the standard
arrays in other languages have such strictures (such as having to be
created with a fixed size, or having to hold only strings or only
numbers).  Those strictures are not built into our normal concept of
"array" either.

Bernard

On Mon, Jun 8, 2009 at 5:41 AM, Kay C Lan<lan.kc.macmail at gmail.com> wrote:
> On Sun, Jun 7, 2009 at 6:00 PM, Bernard Devlin <bdrunrev at gmail.com> wrote:
>
>> Part of the problem is that we refer to these containers in Rev as
>> "arrays".  Really what Rev has is a container that is more
>> appropriately referred to as a "dictionary".  It is commonplace in
>> other languages to expect that a dictionary object will return the
>> keys in an unsorted (and generally unpredictable order).
>>
>> Gee, I realise you are talking about programming languages but in everyday
> language 'dictionary' would invoke an image of extreme order. I'm not
> familiar with other programming languages but to use the term dictionary to
> refer to an unordered list/pair seems bizarre to me. I would think that
> would be an even harder concept to teach to a newbie, at least with array
> it's a term they may not be familiar with and therefore they can be taught
> it's unordered.
>
> As Rev is an English like language, and as you say it's a type of container
> were talking about, I suggest we use sockDraw - everyone knows the order
> they go in has nothing to do with the way they come out, plus it has a pair
> metaphor - left = key, right = value ;-)
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list