[REBOL] Re: RAMBO #3652 unset?
From: rotenca::telvia::it at: 22-Mar-2005 19:07
Arie van Wingerden wrote:
>
>Hi Ladislav / Romano,
>
>in order to get a grip I played around with your examples, but I don't
>understand the following:
>why give the following 2 cases different results?
> 1 >>unset 'var
> >>unset? 'var
> == false
> 2 >>unset? unset 'var
> == true
>
>The only thing I can think of is that unset! is not a datatype of the
>variable being unset.
>E.g. after unset 'x x would not have a datatype of unset! (which I thought
>was true).
>Instead unset! would just be the returned value of unset itself only.
>
1a)
unset 'var
what happens?
- the lit-word! <var> is evaluated and become the word <var>
- unset receives the word <var> and unsets the value of the word <var>
1b) unset? 'var
what happens?
- the lit-word! <var> is evaluated and become the word <var>
- unset? receives the word <var> and answers:
"false: the value <var> is not an unset! value (it is a word!)"
- you can test this with:
word? 'var ; == true
2) unset? unset 'var
what happens?
- the lit-word! <var> is evaluated and become the word <var>
- unset receives the word <var> and unsets the value of the word <var>
- unset returns unset!
- unset? receives the values unset! and answers "true: the value
<unset!> is an unset! value"
- now you can test the value of <var> with one of :
value? 'var ; == false
which is the opposite of::
unset? get/any 'var ;==false
The unset/unset?/value? stuff is a little strange at the beginning, but
when you get the whole frame, all becomes clear.
--
Ciao
Romano Paolo Tenca