[REBOL] Re: relative expressions
From: g:santilli:tiscalinet:it at: 1-Apr-2003 14:57
Hi Gregg,
On Tuesday, April 1, 2003, 6:00:25 AM, you wrote:
BH>> I also wonder how multiple dialects can be usefully mixed together. I mean,
BH>> lets say we have solved two problems plotting (qplot) and pdf making
BH>> (pdfmaker) - shouldn't we aim to be able to mix them so that we could graph
BH>> the number of words per section of a pdf file, or more usefully put a graph
BH>> into a pdf?
GI> Good example. I think a good plotting dialect would become a standard;
GI> then people take that dialect and change the actions behind the rules
GI> to do what they want in a new context. That brings up an important
GI> design point. How to implement dialects so that kind of thing is as
GI> easy as possible.
This is something I've been thinking about too; actually, my
custom-types ides came out from this thinking.
If you think about REBOL's function interpreter, you see it is
based on values. An expression is just a sequence of values, and
depending on the type and the content of these values you get a
result when it is evaluated. When we implement dialects using
block parsing, we are using the same REBOL values to describe
something, and the parser to interpret this and make actions or
translate to something else.
Now imagine if we had types of values that were designed
specifically for our problem domain. In such a case, you would not
even need PARSE rules, but only something that makes the correct
actions for these values. (Notice that in REBOL the "methods" for
datatypes are called "actions". I wonder if this is a
coincidence.) This would solve the reusability problem, because
you just have to change the actions.
However, you still don't have an easy way to "write down" the
values; this is where PARSE comes. You design a dialect with the
rules to parse it and translate it to a (sequence of) (custom)
value(s). It is like VID, that just translates to a FACE, which is
then used by View.
I really think that having custom types helps a lot with this;
just having objects is fine with things like View, because you
only have one kind of object, i.e. the FACE. In domains that are
more complicated (maybe just because we are not smart enough to
make them simpler...) you can easily have the need for many kinds
of objects.
So you get three layers:
Language (dialect)
------------------
Values
------------------
Actions
The "values" layer is something that you don't have in languages
other than REBOL (at least that I know of). It is the layers that
allows dialecting, and that gives REBOL all of its simplicity and
flexibility; I think we should use this approach too!
What do you think?
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r