[REBOL] Re: relative expressions
From: brett:codeconscious at: 2-Apr-2003 19:40
Hi Gabriele,
> 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.
It took me ages (over a year) to come to realise this about REBOL despite
the fact that it is fairly plainly described as you have just done (good
work!) and that it is described in the Core manual!
> 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.
So, custom types would allow the REBOL interepreter to interpret these
expressions directly. Another benefit is that our normal understanding of
how REBOL interprets values is used when thinking about these custom values.
But I don't think that changing the actions will be entirely sufficient for
reusability, although I do agree it could be very powerful.
> 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.
Agreed, though VID does more than create FACEs, it also arranges them
(layout). VID is building/maintaining state (e.g offset) as it processes the
dialect. I know this seems obvious but I feel it is important to highlight
that dialects may have this extra "between the lines" - value adding aspect.
I think this relates to Nørretrander's "Exformation"
concept(http//www.quinion.com/words/turnsofphrase/tp-exf1.htm).
Also in relation to parsing dialects, I'd like to see a methodology for
designing dialects so that they can be usefully mixed together (as I
mentioned). Some sort of grammar convention might help here.
> 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.
Yes custom types could be very important. Though they may not be so good for
message passing between distributed systems because they might introduce
unwelcome dependencies ("do you have custom type xyz-floating-graphic?").
> 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!
That's a really interesting observation. Deserves more reflection :^)
Regards,
Brett