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

[REBOL] Re: Is Rebol dynamic?

From: lmecir:mbox:vol:cz at: 29-Nov-2002 9:30

Yes, Andrew, you have got it right.
> > I think that it is safe to change 1 or more elements of block during
execution, but not to insert/remove any item.
> > > > Can changing (not inserting) be a safe programming style for future
releases?
> I think it's probably due to Rebol resizing the block? Perhaps if the
block was allocated enough space in the first place, then the insert could work.
> > Andrew Martin
If we try the same example as before, we will see:
>> block2: make block! 8
== []
>> append block2 [print 1 (insert tail block2 1 block2/5: 3) print 2]
== [print 1 (insert tail block2 1 block2/5: 3) print 2]
>> do block2
1 3 BTW, if we preallocated less than 8, the behaviour would differ, although the final block size is 6 elements... Nevertheless, I think, that I proved, that neither inserts nor changes are safe. If you want to see an unsafe change, look at this: block3: [a: (block3/1: first [/a] 1)] do block3 -L