>If one insists on establishing two words referring to the same data,
then before one clears one he should 'unset the other.  

Personally, I'd like a determination from REBOL Tech on whether "using
two words to refer to the same data" is bad practice, or whether we're
just encounting bugs in some of the series functions, particularly
CLEAR.

The examples in the docs do seem to encourage using multiple variables,
and imply the only time we should get errors is when using "The
functions first, second, third, fourth, fifth, and last" (use PICK
instead). Everything else is suppose to return NONE or an empty block.

In further testing, I'm finding that CLEAR seems to work properly if
the other variables are at the head or tail, but not when they are set
to another index. 

*********** REPLY SEPARATOR  ***********

On 12/12/1999 at 3:29 PM [EMAIL PROTECTED] wrote:

REBOL's clear and Scheme's clear are not analogous.  REBOL's clear
doesn't
clear the stored data, it "disconnects" 'list (your example) from it
and
eventually the garbage collector reclaims the unused memory where the
data
is stored.  REBOL's 'clear is a lot faster, especially for large
series.  If
you want list2 to reference the same data, but copied to a fresh
location,
use copy, i.e., list2: copy next list.  This allows you to mess with
'list
without affecting 'list2.  If one insists on establishing two words
referring to the same data, then before one clears one he should 'unset
the
other.  Perhaps 'unset should be used in place of 'clear. Here's some
diddling around with unset.

>> list1: [1 2 3 4]
== [1 2 3 4]
>> list2: next list1
== [2 3 4]
>> unset [list2]
>> list2
** Script Error: list2 has no value.
** Where: list2
>> list1
== [1 2 3 4]
>> list2: next list1
== [2 3 4]
>> unset [list1]
>> list2
== [2 3 4]
>> head list2
== [1 2 3 4]
>> list1
** Script Error: list1 has no value.
** Where: list1
>> unset[list2]
>> list2
** Script Error: list2 has no value.
** Where: list2

Note unset-ing list1 doesn't seem to bother list2
>>
Russell [EMAIL PROTECTED]


Reply via email to