----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, February 28, 2000 3:41 AM
Subject: [REBOL] [BUG] unset! (and "help" function lie!)


>
> Hi Olivier,
>
> you wrote:
>
> >So unset! seems to be a datatype.
> >Lets verify if unset! is a datatype :
> >
> >>> type? file!
> >== datatype!
> >>> type? unset!
> >** Script Error: unset! has no value.
> >** Where: type? unset!
>
> One of REBOL's most confusing issues is that representations of some
values
> look exactly like the words they are assigned to. These values cannot be
> directly parsed by REBOL - first they are parsed to words, and then the
word
> is evaluated.
>
> When you did:
>
> >> type? file!
> == datatype!
>
> REBOL first parsed the string you typed, "file!", to the word file!, and
> then when that word is used as the argument of TYPE? it is evaluated. The
> word FILE! is preset to the datatype! file!, which is the value that the
> function TYPE? sees.
>

I had no problem with that.
My point was that unset! is not preset to any value.

[...]

> Now the problem with unset! is that there is no word set to the value
> unset! . This is easily fixed:
>
> >> unset: (type?)
> == unset!
> >> type? unset!
> == datatype!
>

Of course. I should have thought to this.


> I put the paren around type? because if you do this in a script TYPE? will
> take the value of whatever is next, but the paren prevents TYPE? from
seeing
> anything else.
>
>
> You also wrote:
>
> >>> type? file!
> >== datatype!
> >>> help file!
> >file! is word of value: file
> >
> >This not ok!
>
> It seems inconsistent, but this is the result of a REBOL trick. HELP has a
> special way of specifying its argument:
>

I'm writing this kind of messages to [EMAIL PROTECTED] not to get a
work-around, but for them to make it consistent while REBOL is still not
widely spread.

> help: func [
>     "Prints information about words and values."
>     'word [any-type!]
>     /local value args item refmode types
> ][
> <snip>
> ]
>
> The argument is specified as a lit-word! (by using the ' ). This specifies
> that if the argument is actually a word, that word is to be unevaluated.

Thanks for this explanation. Passing parameters as lit-word! is a very cool
feature.

> That is, HELP wants to see the word itself, not what the word is set to.
> This way you can use HELP to test if a word is set to a value:
>
> >> help grog
> No information on grog (word has no value)
>
> Otherwise, trying to evaluate the word grog would result in an error
> before HELP even had a chance to see it.
>
> So, if you want to get help on the value that the word is set to, try
this:
>
> >> help (file!)
> file! is datatype
> >> help file!
> file! is word of value: file
>
> Putting the word file! in a paren prevents HELP from seeing it as a word.
> So the paren is evaluated, the datatype! file! comes out, and HELP
> tells you that the datatype! file! is a datatype.

We also get the same result with the following the ':' operator :
>> help :file!
file! is datatype

This is what I expected from
>> help file!

(without using :)


I just wanted that they modify the 'help' function to be more informative
about datatypes.

>
> One other little issue here is that there are two ways of representing a
> value, forming and molding. Molding is better in that it gives you a
string
> that REBOL can use to get back the original value, but forming is supposed
> to be easier on the eye. HELP forms the values, which is why you lose
> the ! 's.
>
>
> See you,
> Eric
>

With all those good explanations on the heart of the language, it's now time
for me to re-read the REBOL user guide from the beginning, to understand
every feature.

Thanks Eric.


Reply via email to