Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] copy versus copy/deep Re:

From: galtbarber:mailandnews at: 28-Aug-2000 15:07

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 in your blocks instead of just integer values then you would see a difference.
>> x: [a b c d]
== [a b c d]
>> b: []
== []
>> insert/only b :x
== []
>> b
== [[a b c d]]
>> c: copy b
== [[a b c d]]
>> d: copy/deep b
== [[a b c d]]
>> remove x
== [b c d]
>> c
== [[b c d]]
>> d
== [[a b c d]]