Hi Andrew,

>Short and somewhat surprising:
>>> [.]
>== [.]
>>> [,]
>** Syntax Error: Invalid word -- ,.
>** Where: (line 1) [,]

I think it's because Carl really hates commas. ;-)

But seriously, for some reason, the only place REBOL seems to use commas is
as an alternative decimal point in numbers.

You can put almost anything in a block, but it has to be loadable - meaning
REBOL can parse it and recognize everything in the block as some kind of
datatype. For example you can't do this:

>> [223abc]
** Syntax Error: Invalid integer -- 223abc.
** Where: (line 1) [223abc]
>> [22.3abc]
** Syntax Error: Invalid decimal -- 22.3abc.
** Where: (line 1) [22.3abc]

REBOL won't parse anything beginning with digits that doesn't turn out to
be a valid number. REBOL allows a lot of characters as parts of words that
most other languages don't allow in variable names:

   ? ! . ' + - * & | = _ ~  (from the beta manual)

which fosters the impression that "anything goes", but that's not quite the
case:

>> [abc,def]
** Syntax Error: Invalid word -- abc,def.
** Where: (line 1) [abc,def]

So apparently when REBOL tries to load a single comma, it doesn't have any
other evidence as to what kind of data type you meant, so assumes you
meant a word.

>The first example uses a full stop ".", the second uses a comma ",". Now
>this:
>
>>> [1,2]
>== [1.2]
>
>Note that the comma changed to a full stop.

So here REBOL parses "1,2" as a decimal, and shows it back to you in the
"standard" way. A decimal value has no way to "remember" the original form
it was parsed from:

>>> [12.3000000000]
>== [12.3]
>
>>> [%]
>** Syntax Error: Invalid file -- %.
>** Where: (line 1) [%]

You can construct a valid filename of length zero this way:

>> [%""]
== [%]

>I was under the impression a block could contain virtually anything and was
>not evaluated. What about a block containing, perhaps some JavaScript code:

Well, no. Blocks have to contain valid items of data, or you could never use
functions like FIRST, PICK, NEXT .... on them.

>
>>> c: [test (1, 2)]
>== [test (1 2)]
>>> c
>== [test (1 2)]
>
>I wonder where the "," went?

The same place the "." goes:

>> [test (1. 2)]
== [test (1 2)]

If you want to store code from alien languages, maybe you should consider
using strings. ;-)

See you,
Eric

>I've sent this to [EMAIL PROTECTED]
>
>It would be nice if blocks were slightly less processed.
>
>Andrew Martin
>ICQ: 26227169
>[EMAIL PROTECTED]
>http://members.xoom.com/AndrewMartin/
>-><-

Reply via email to