Nested array comparisons

Mark Schonewille m.schonewille at economy-x-talk.com
Sun Mar 24 18:51:12 CDT 2013


Hi Dick,

At the start of this thread, it was observed that comparison of arrays 
as suggested by the documentation may detect false positives.

Keys of arrays are sorted when they are used by a function or a get or 
put command. The sort is not random, as I stated before. Therefore, the 
arrays must be equal.

I don´t know if the hash is created before or after the sort, so I can´t 
comment on that. We´ll be able read the source code soon and then we all 
can know this kind of things.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other 
colour spaces. http://www.color-converter.com

We have time for new software development projects. Contact me for a quote.

On 3/24/2013 23:41, Dick Kriesel wrote:
>
> On Mar 24, 2013, at 1:29 PM, Mark Schonewille <m.schonewille at economy-x-talk.com> wrote:
>
>> As you can conclude from
>>
>> "To compare two arrays, simply use the = operator directly on them rather than encoding them first."
>>
>> the documenation, particularly with regard to arrays, is not always correct.
>
> Hi, Mark.
>
> Of course documentation isn't always correct, but I don't see how to conclude that from that sentence.  In my experience, that sentence has been correct.  What's incorrect about it?
>
>>
>> Moreover, I would expect that computers return the same value when doing two equal calculations in the same way under equal circumstances.
>
> ArrayEncode encodes not only the keys and values we can see in the array but also the hash keys we cannot see.  The invisible hash keys depend in part on the sequence in which the keys were added to the array, so they may be different for two equal arrays, so the encodings may be different too.
>
> At least, that's what I remember reading somewhere.  Sorry, I don't remember where.
>
> -- Dick



More information about the use-livecode mailing list