REBOL/View 1.3 - invalid word datatype
[1/10] from: rebol-list2::seznam::cz at: 15-Dec-2003 14:50
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)]
Thank you for your response,
David Oliva alias Oldes
--
Best regards,
rebOldes -----------------[ http://oldes.multimedia.cz/ ]
[2/10] 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
<<quoted lines omitted: 26>>
> ** 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
[3/10] from: g:santilli:tiscalinet:it at: 16-Dec-2003 10:35
Hi rebOldes,
On Monday, December 15, 2003, 2:50:06 PM, you wrote:
r> I think the best way would be to handle these 'invalid' words as a
r> special word which would not be able to hold some values but I would
r> be able to parse this word as a normal string.
You can use string parsing and then convert the strings to words.
(You could even just use LOAD/NEXT and then use To-WORD when an
invalid word error occurs.)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
[4/10] from: rebol-list2:seznam:cz at: 16-Dec-2003 18:09
Hello Gabriele,
Tuesday, December 16, 2003, 10:35:37 AM, you wrote:
GS> Hi rebOldes,
GS> On Monday, December 15, 2003, 2:50:06 PM, you wrote:
r>> I think the best way would be to handle these 'invalid' words as a
r>> special word which would not be able to hold some values but I would
r>> be able to parse this word as a normal string.
GS> You can use string parsing and then convert the strings to words.
GS> (You could even just use LOAD/NEXT and then use To-WORD when an
GS> invalid word error occurs.)
I can, but it's much more slower and it would mean to make it
completely again. Maybe I could use load/next but how to convert
invalid word to word?
I would like to have at least special load refinement to convert
invalid words to something usable (strings are not the best solution,
because than I may have problem recognize if it was normal string or
just a variable which was not parsed as a normal datatype - that means
I would like to have something I what I call 'invalid datatype'
But it looks that i will have to wait a few years (if I would have a
luck a something will happen)
GS> Regards,
GS> Gabriele.
GS> --
GS> Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
GS> Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
--
Best regards,
rebOldes -----------------[ http://oldes.multimedia.cz/ ]
[5/10] from: rebol-list2:seznam:cz at: 16-Dec-2003 18:14
Hello Carl,
Tuesday, December 16, 2003, 8:45:56 AM, you wrote:
CR> On 16-Dec-03, rebOldes wrote:
>> Hello Carl,
>> As you are preparing new build of Rebol, I would like to ask you, If
<<quoted lines omitted: 26>>
>> ** Syntax Error: Invalid word -- a,
>> ** Near: (line 1) load [myFunc(a, 2, a + b)]
CR> The problem would be that real errors wouldn't be caught. Maybe we
CR> need a special type of block that would allow this? (Which would
CR> require a new datatype - well, two new datatypes - the special block
CR> and an unknown! datatype.)
CR> Which is non-trivial I suspect.
unknown! is a good name. For me it would be enough if such a datatype
would be recognized during 'load function - so it seems not to be such
a problem to me. Now we have a name as well:)
CR> For your Flash dialect Oldes, have you thought about a two-pass
CR> approach? The first pass would parse the file as a string,
CR> converting your myFunc(a, 2, a + b)s and so on to strings (or what
CR> datatypes or group of datatypes best suit them), with the second pass
CR> performing the main parse.
It's not a solution for something like objects/:i._x which I would
like to parse as _x possition of object i from array of objects.
Something what's not possible even in Rebol, but something, what could
be parsed in dialect easily if I would be able to load such a code.
Now I need to write:
tmp: objects/:i
tmp._x
CR> --
CR> Carl Read
--
Best regards,
rebOldes -----------------[ http://oldes.multimedia.cz/ ]
[6/10] from: g:santilli:tiscalinet:it at: 18-Dec-2003 10:42
Hi rebOldes,
On Tuesday, December 16, 2003, 6:09:34 PM, you wrote:
r> I can, but it's much more slower and it would mean to make it
r> completely again. Maybe I could use load/next but how to convert
r> invalid word to word?
>> to word! "whatever you wish"
== whatever you wish
>> to word! "1,4"
== 1,4
>> to word! "fun(call, me, args)"
== fun(call, me, args)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
[7/10] from: carl:cybercraft at: 24-Dec-2003 22:52
On 18-Dec-03, Gabriele Santilli wrote:
> Hi rebOldes,
> On Tuesday, December 16, 2003, 6:09:34 PM, you wrote:
<<quoted lines omitted: 7>>
>>> to word! "fun(call, me, args)"
> == fun(call, me, args)
Hmmmmmmmmmmmmmmmmmmmmmmmmm.......................
--
Carl Read
[8/10] from: rebol-list2:seznam:cz at: 18-Dec-2003 20:34
Hello Gabriele,
Thursday, December 18, 2003, 10:42:33 AM, you wrote:
GS> Hi rebOldes,
GS> On Tuesday, December 16, 2003, 6:09:34 PM, you wrote:
r>> I can, but it's much more slower and it would mean to make it
r>> completely again. Maybe I could use load/next but how to convert
r>> invalid word to word?
>>> to word! "whatever you wish"
GS> == whatever you wish
>>> to word! "1,4"
GS> == 1,4
>>> to word! "fun(call, me, args)"
GS> == fun(call, me, args)
Very interesting.
Thanks
GS> Regards,
GS> Gabriele.
GS> --
GS> Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
GS> Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
--
Best regards,
rebOldes -----------------[ http://oldes.multimedia.cz/ ]
[9/10] from: rebol-list2:seznam:cz at: 20-Dec-2003 16:57
Hello Gabriele,
Thursday, December 18, 2003, 10:42:33 AM, you wrote:
GS> Hi rebOldes,
GS> On Tuesday, December 16, 2003, 6:09:34 PM, you wrote:
r>> I can, but it's much more slower and it would mean to make it
r>> completely again. Maybe I could use load/next but how to convert
r>> invalid word to word?
>>> to word! "whatever you wish"
GS> == whatever you wish
>>> to word! "1,4"
GS> == 1,4
>>> to word! "fun(call, me, args)"
GS> == fun(call, me, args)
It's interesting, but how to use it? If you put load (or load/next) it
would throw the error anyway:(
>> x: "1 2 3"
== "1 2 3"
>> while [not empty? x][
[ set [y x] load/next x
[ print [mold y mold x]
[ ]
1 " 2 3"
2 " 3"
3 ""
>>
>> x: "1 2 a,b,c 3 4 d/:i._x"
== "1 2 a,b,c 3 4 d/:i._x"
>> while [not empty? x][
[ set [y x] load/next x
[ print [mold y mold x]
[ ]
1 " 2 a,b,c 3 4 d/:i._x"
2 " a,b,c 3 4 d/:i._x"
** Syntax Error: Invalid word -- a,b,c
** Near: (line 1) a,b,c 3 4 d/:i._x
>>
Anyway it would be useful only if the unknow! datatype would hold all
value which would cause the problem:
For example in:
>> load "d/1.item._x"
** Syntax Error: Invalid tuple -- 1.item._x
** Near: (line 1) d/1.item._x
Would return 'd/1.item._x' not only '1.item._x'
--
Best regards,
rebOldes -----------------[ http://oldes.multimedia.cz/ ]
[10/10] from: antonr:iinet:au at: 26-Dec-2003 12:04
Well, I would assume you would catch the error,
and then try to apply your own parse rules.
You would have to try to split paths up, then
reapply the load/catch/try-to-parse cycle on the
pieces.
Or your code could avoid path notation altogether,
using pick, eg. pick d i._x
then you don't have to recursively apply parse
rules on pieces of a path.
Anton.
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted