Dick Kriesel to the rescue again! Thanks for that background. Comforting to know it's not merely an anomaly, but a well-considered design decision.

It's such a cool thing to be able to do.  It will change many algos here...

--
 Richard Gaskin
 Fourth World Systems

Dick Kriesel wrote:
On Apr 26, 2018, at 12:14 PM, Brian Milby via use-livecode <use-livecode at 
lists.runrev.com <mailto:use-livecode at lists.runrev.com>> wrote:

tPath can also be thought of as a (proper) list which makes a little more
sense. Mark W would need to answer the why.

The following excerpts provide a quote from Mark W:

On Mar 12, 2012, at 10:19 AM, Pete wrote:

I'm wondering how you found about about this key values array feature?  I
can't find any mention of it in the dictionary or the reference manual and
it sure seems like something that should be known!



On Mar 12, 2012, at 1:18 PM, Dick Kriesel <dick.kriesel at mail.com 
<mailto:dick.kriesel at mail.com>> wrote:

I found it while looking through bug reports for arrays, in 
<http://quality.runrev.com/show_bug.cgi?id=7166 
<http://quality.runrev.com/show_bug.cgi?id=7166>> dated 2008-11-28.  So, thanks be 
to Mark Waddingham and David Bovill for that.

For convenience, here's Mark's reply to David:

Thanks for the suggestion.

This is on the list to include for the next version. In that version with:
 put tValue into tArray[tKey]
(indeed anywhere you can currently do tArray[tKey])

The meaning of 'tKey' will be extended:
 1) If it is a string then it is as it is now
 2) If it is a numerically keyed array starting at 1, then it will mean:
      put tValue into tArray[tKey[1]][tKey[2]]...[tKey[n]]
    where <n> is the number of elements in tKey
 3) Otherwise it is an error.

This will allow you to construct an array containing the path to the key you
want to modify/fetch/delete dynamically.

I agree, the feature's worth adding into the dictionary and manual.

-- Dick


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to