Re: Changing array key text

2019-06-25 Thread Mark Wieder via use-livecode
On 6/25/19 8:46 PM, Brian Milby via use-livecode wrote: Nothing gets put into limbo.  The pointer is deleted/removed from the array thus reducing the reference count held by the object containing the value.  In the above example, the only pointer left is the one held by tSubArray until a copy

Re: Changing array key text

2019-06-25 Thread Brian Milby via use-livecode
Nothing gets put into limbo.  The pointer is deleted/removed from the array thus reducing the reference count held by the object containing the value.  In the above example, the only pointer left is the one held by tSubArray until a copy of the pointer is placed in the array as the new key which

Re: Changing array key text

2019-06-25 Thread Mark Wieder via use-livecode
On 6/25/19 4:31 PM, Brian Milby via use-livecode wrote: Value object starts with a ref count of 1 in the array The first put increases the ref count to 2 The delete takes it back to 1 The second put takes it back to 2 At the end of the handler it goes back to 1 since the local var goes away Mmm

Re: Changing array key text

2019-06-25 Thread Brian Milby via use-livecode
Value object starts with a ref count of 1 in the array The first put increases the ref count to 2 The delete takes it back to 1 The second put takes it back to 2 At the end of the handler it goes back to 1 since the local var goes away Thanks, Brian On Jun 25, 2019, 6:35 PM -0400, Mark Wieder via

Re: Changing array key text

2019-06-25 Thread Mark Wieder via use-livecode
On 6/25/19 1:25 AM, Mark Waddingham via use-livecode wrote: On 2019-06-25 04:18, Brian Milby via use-livecode wrote: My guess is that it has to do with the copy on write property of arrays.  If you used your method it may force an actual duplication.  The existing method just passes a pointer ef

Re: Changing array key text

2019-06-25 Thread Bob Sneidar via use-livecode
:-) > On Jun 24, 2019, at 20:55 , J. Landman Gay via use-livecode > wrote: > > I love when you guys talk geek to me. "Tell me more about my > arrays." > > https://youtu.be/dEaFFZpfxLU > > -- > Jacqueline Landman Gay | jac...@hyperactivesw.com __

Re: Changing array key text

2019-06-25 Thread Mark Waddingham via use-livecode
On 2019-06-25 04:18, Brian Milby via use-livecode wrote: My guess is that it has to do with the copy on write property of arrays.  If you used your method it may force an actual duplication.  The existing method just passes a pointer effectively.  I could be totally wrong though. On Jun 24, 2019

Re: Changing array key text

2019-06-24 Thread J. Landman Gay via use-livecode
I love when you guys talk geek to me. "Tell me more about my arrays." https://youtu.be/dEaFFZpfxLU -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On June 24, 2019 9:44:55 PM Mark Wieder via use-livecode wrote: On 6/24/19 7:18 PM, B

Re: Changing array key text

2019-06-24 Thread Mark Wieder via use-livecode
On 6/24/19 7:18 PM, Brian Milby via use-livecode wrote: My guess is that it has to do with the copy on write property of arrays.  If you used your method it may force an actual duplication.  The existing method just passes a pointer effectively.  I could be totally wrong though. Dunno. Possib

Re: Changing array key text

2019-06-24 Thread Brian Milby via use-livecode
My guess is that it has to do with the copy on write property of arrays.  If you used your method it may force an actual duplication.  The existing method just passes a pointer effectively.  I could be totally wrong though. Thanks, Brian On Jun 24, 2019, 10:11 PM -0400, Mark Wieder via use-livec

Re: Changing array key text

2019-06-24 Thread Mark Wieder via use-livecode
On 6/24/19 7:00 PM, Brian Milby via use-livecode wrote: Close, here's the actual code (part of setArrayKeyOnPath): put xArray[item 1 of pPath] into tSubArray delete variable xArray[item 1 of pPath] put tSubArray into xArray[pKey] Interesting. Wouldn't it be faster to do p

Re: Changing array key text

2019-06-24 Thread Brian Milby via use-livecode
Close, here's the actual code (part of setArrayKeyOnPath): put xArray[item 1 of pPath] into tSubArray delete variable xArray[item 1 of pPath] put tSubArray into xArray[pKey] I didn't specify the first step in my original answer. I only knew about this because I had been looking

Re: Changing array key text

2019-06-24 Thread Mark Wieder via use-livecode
On 6/24/19 12:37 PM, Brian Milby via use-livecode wrote: I’m pretty sure the PI deletes the old key and creates a new key with the existing value. I'm pretty sure (in this post-facts world I haven't actually looked) it's the other way around: copy the existing contents into the new key, *the

Re: Changing array key text

2019-06-24 Thread J. Landman Gay via use-livecode
Thanks, I hadn't thought of just extracting a chunk of the array. I should have. On 6/24/19 2:37 PM, Brian Milby via use-livecode wrote: I’m pretty sure the PI deletes the old key and creates a new key with the existing value. Thanks, Brian On Jun 24, 2019, 3:23 PM -0400, J. Landman Gay via u

Re: Changing array key text

2019-06-24 Thread Brian Milby via use-livecode
I’m pretty sure the PI deletes the old key and creates a new key with the existing value. Thanks, Brian On Jun 24, 2019, 3:23 PM -0400, J. Landman Gay via use-livecode , wrote: > I have a multi-dimensional array and sometimes I need to change the text > of one of the array keys without destroyin