[REBOL] Re: REBOL/View 1.3 - invalid word datatype
From: carl:cybercraft at: 24-Dec-2003 22:51
On 16-Dec-03, rebOldes wrote:
> Hello Carl,
> As you are preparing new build of Rebol, I would like to ask you, If
> it would be possible to change somehow handling of "invalid
> datatypes"
> As I'm working on a probably the largest known dialect using Rebol -
> the Rebol/Flash dialect ( http://oldes.multimedia.cz/swf/ ), I
> still feel very limited because of impossibility to use some words.
> For example I would like to have in my dialect code words like this
> one:
>>> objects/1._x
> ** Syntax Error: Invalid decimal -- 1._x
> ** Near: (line 1) objects/1._x
> As you can see, it's recognized as an invalid decimal. So here comes
> the question. Would it be possible to change this behavior to
> something which we could use? There were already some discussions on
> mailing list about this issue months ago, but I still don't know
> your opinion.
> I think the best way would be to handle these 'invalid' words as a
> special word which would not be able to hold some values but I would
> be able to parse this word as a normal string.
> If it will be a problem maybe it would help to use some refinement
> in the 'load function not to throw these "invalid datatype" errors
> and convert these "invalid datatypes".
> If you would make this change, I would be able to make for example
> functions as are known in other languages for example:
> myFunc(a, 2, a + b)
> because loading such a dialect would not throw error like:
>>> load [myFunc(a, 2, a + b)]
> ** Syntax Error: Invalid word -- a,
> ** Near: (line 1) load [myFunc(a, 2, a + b)]
The problem would be that real errors wouldn't be caught. Maybe we
need a special type of block that would allow this? (Which would
require a new datatype - well, two new datatypes - the special block
and an unknown! datatype.)
Which is non-trivial I suspect.
For your Flash dialect Oldes, have you thought about a two-pass
approach? The first pass would parse the file as a string,
converting your myFunc(a, 2, a + b)s and so on to strings (or what
datatypes or group of datatypes best suit them), with the second pass
performing the main parse.
--
Carl Read