Hi,
Here is a quick program to demonstrate this within a VID window:
rebol[
title: "Copy vs Copy/Deep"
]
show-all: does [
show [xf yf z1f z2f]
]
lay: layout [
text "click each of the buttons in turn"
across
text "x" xf: fieldxc: button "x: [1 2 3]" [do xc/text xf/text: x show-all]
If you assign multiple references
to the same memory, then there will be a difference.
With copy/deep, you get a separate instance of
everything. Without it, only the reference is used.
It may seem like a subtle point, but one still worth
looking at. Also, if you are storing object references
See what happens, after executing the code from your example, if you
modify a nested sub-block of a. That's the difference.
>> append a/3/2 99
== [4 5 99]
>> a
== [1 2 [3 [4 5 99] 6] 7 8]
>> b
== [1 2 [3 [4 5 99] 6] 7 8]
>> c
== [1 2 [3 [4 5] 6] 7 8]
>>
-jn-
[EMAIL PROTECTED] wrote:
>
> As my
Hi,
The difference:
a: [[1]]
b: copy a
c: copy/deep a
change first a 2
probe a
probe b
probe c
Regards
Ladislav
- Puvodní zpráva -
Od: <[EMAIL PROTECTED]>
Komu: <[EMAIL PROTECTED]>
Odesláno: 28. srpna 2000 16:33
Predmet: [REBOL] copy versus copy/deep
> As my exam
000 09:33 AM
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: [REBOL] copy versus copy/deep
As my example below shows, there does not appear to a difference in
handling nested blocks between copy and copy/deep
>> a: [ 1 2 [ 3 [ 4 5 ] 6 ] 7 8 ]
== [1 2 [3 [4 5] 6
As my example below shows, there does not appear to a difference in handling nested
blocks between copy and copy/deep
>> a: [ 1 2 [ 3 [ 4 5 ] 6 ] 7 8 ]
== [1 2 [3 [4 5] 6] 7 8]
>> b: copy a
== [1 2 [3 [4 5] 6] 7 8]
>> b
== [1 2 [3 [4 5] 6] 7 8]
>> c: copy/deep a
== [1 2 [3 [4 5] 6] 7 8]
>> c
==