A Lingo puzzle (at least for me):

The Number 1 sequence, below, indicates that when a variable is assigned a value that is taken from a property list, the assignment is done by value; the original list is not affected, when you change the value of the new variable.

The Number 2 sequence--using deleteProp()--indicates the reverse, i.e. that the new variable becomes a pointer to the list, and changing it in fact changes the original list.

Number 1:
Test=[#a : ["a", "b"]]
Test1 = Test[#a]
put Test1
-- ["a", "b"]
Test1 = ["x", "y"]
put Test
-- [#a: ["a", "b"]]

Number 2:
Test=[#a : ["a", "b"]]
Test1 = Test[#a]
put Test1
-- ["a", "b"]
Test1.deleteProp(1)
put Test1
-- ["b"]
put Test
-- [#a: ["b"]]

Questions:
1) Why the different behavior? How is it useful?
2) I want to delete an item from my Test1 w/o affecting the original list Test. How?

Thanks for any tips!

Slava

[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]

Reply via email to