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

[REBOL] Strange array behavior

From: geza67:freestart:hu at: 21-May-2002 19:54

Librarian comment

This bug has been fixed
Hi REBOL-fellows! Why does not properly work this code segment:
>> a: array/initial [3 2] [[]]
== [[[] []] [[] []] [[] []]]
>> append a/1/2 3
== [3]
>> a
== [[[3] [3]] [[3] [3]] [[3] [3]]] Hmmm, I' ve expected at querying 'a : == [[[] [3]] [[] []] [[] []]] Maybe the prototype initial value is a reference not a true value? OK, I tried it even this way:
>> a: array/initial [3 2] copy [[]]
Maybe that even 'copy has made only ONE copy and five references to it in array 'a ? Now, if I want to manipulate arrays with "appendable" empty lists, I don't give initial values and change each occurrances of 'none to copy/deep [[]] and THEN append to the defined location. Is this the best practice to overcome the seeming limitation of 'array ? Best wishes: Geza