Weird array comparison limitation

Robert Sneidar slylabs13 at me.com
Sat Dec 1 15:09:47 EST 2012


Can't you use not (aArray1 = aArray2)?

Bob


On Nov 28, 2012, at 10:43 AM, Alex Tweedly wrote:

> You can compare two arrays for being equal - but you can't compare them for being unequal !
> 
> As the dictionary says (under the "=" operator), you can compare two arrays, and it will check that the number of keys is the same, and then that each element is the same - therefore it works just like you'd hope and expect for multi-level arrays.
> 
> But the dictionary entry for "is not" (i.e. not equal,  the "<>" operator) does not mention arrays, and indeed you cannot get reliable results from it (ok- they *may* be reliable - but they're not useful :-)
> 
> Here's a snippet from my Message Box - the global array gives me data to start with, I copy it, then change it, so they are in fact not quite the same - one element  has been changed ....
> 
>> global gATermInfo
>> put gAtermInfo into gA2
>> add 1 to gA2["year"]
>> put   gA2["year"] && (gATerminfo = gA2 ) && (gATerminfo <> gA2 )
>> 
> 
> produces
> 
>> 2013 false false
> 
> I guess it's not strictly speaking a bug, since the dictionary doesn't claim that it should do the sensible thing. But it's so intuitively obvious that it ought to work, and must be so easy to make it work, that I kind of think it should be fixed.
> 
> Or am I missing some reason ? or some history that would demand backwards compatability ?
> 
> Thanks
> -- Alex.
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list