[REBOL] Limitation coming from the "initialize" refinement used with the "Array"
From: gerardcote::sympatico::ca at: 26-Jun-2002 14:48
As I tried to generate a dynamic line of code to create a way to circumvent
the way REBOL interprets the ARRAY notation when used with variable indexes
instead of numeric constants (nothing really hard with REBOL), I found some
limitation with the initialize refinement as following : It seems only
possible to use the same constant (a scalar value or any other datatype
seems to be is accepted) as the initial value used by the Array word itself.
Here is my example code ( I tried it directly at the concole) :
tab_nbr: array/initial [3 2] 0 cells contents are all initialized to
the 0 value
tab_nbr/2/1: 10 cell content [2 1] is updated to 10
print tab_nbr/:L/:C I verify that all is OK
tab_nbr/:L/:C: 20 But this one doesn't work, so I
dynamically generated the real line and asked
REBOL to execute it.
The wanted expression was
: tab_nbr/2/1: 20
and this can be given by
join join join join "tab_nbr/" L join "/" C ": " 20
which generates ==
then the "do" word will do it like this.
do join join join join "tab_nbr/" L join "/" C ": " 20
But now that I can use real variable indexes with my array, am I supposed to
use loops too just to get
any cell value initialized with something other than some constant like the
series of values : 10, 20 , 30 , 40 50 and 60.
Would it not be simpler to have something like this :
tab_nbr: array/initial/series [3 2] 10 60 10 where the start, stop and
increment values would be respectively 10 60 and 10.
IS this already possible in another way that I am not aware of ?
While I am at it, I also tried to use the word "reduce" and a to-block
conversion instead of the word "do" but it seems that the refered object
(tab_nbr) is not in the same context.
So is there a way to notify REBOL that we want it to share some valuable
information from a context to another one or do we have to define it for the
global one, which in this case is not under my control
Thanks to all for any clue if any,