[REBOL] Re: When is none not none?
From: moliad::gmail::com at: 26-Jul-2007 11:47
Welcome to Rebol, hope you have a blast.
what you are experiencing is a subtlety of static run-time loading and
binding. some functions evaluate values and others do not. in this case,
compose loads a block and leaves everything within AS-IS. so since the
interpreter has to put the none somewhere as something, it stays a word,
gets bound to the global definition of none, but isn't evaluated, so its not
yet a none *value*.
I have had the same (I thought "strange", at the time) problems with the
true and false values, which have no lexical form which allows them to be
explicitly cast as a datatype.
since many of us have lived through this exact issue, I can already warn you
about loading data files. nested blocks, do not recursively get evaluated
by load, so you can end up with this same problem when saving out blocks and
objects and stuff.
a good way to identify this is to use the mold/all function which
*serializes* the data. in fact, I have replaced probe in my setup so that
it molds/all in order to clearly identify datatypes.
ex of mold/all usage:
>>a: mold/all compose [none (none)]
== "[none #[none]]"
this allows you to realize without chance of a subtle error, just what is
going on. Note that mold returns a string. then whenever you do a load of
that string, you know that it will return exactly, value-wise, like it was.
On 7/26/07, Henrik Mikael Kristensen <henrik-webz.dk> wrote: