The reason Number 1 'works' is because you changed the link that gets assigned to Test1.
If you want Test1 to contain a copy of ["a", "b"], then you need to use .duplicate
hth
-Buzz
At 12:19 AM -0500 2/7/03, you wrote:
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!]
[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!]
