[EMAIL PROTECTED] wrote:
> > How is dialecting different from defining a new word in Forth? How does
this make REBOL better than any language which allows you to define new
words?
And Elan replied:
> Dialecting goes beyond just extending REBOL's vocabulary. It permits you
to also define your own syntactic structures (i.e. language grammar).
>
> >How does this make REBOL better than any language
> >which allows you to define new words?
>
> Some differences between REBOL and languages that allow you to define new
words:
> 1. There are now holy cows, i.e. keywords. REBOL allows you to define new
words as well as any word from REBOL's existing vocabulary to be anything
you want.
For example, I can (and do) define 'head to mean the head section of a
HTML dialect, whereas in REBOL it normally means return the head of a
series.
> 2. Using REBOL's dialecting support, you can also define new syntactic
structures.
For example, replacing loop constructs which normally return the results
of a block as an item to instead return items in a block ready to be joined.
Very handy for making tables in HTML.
> 3. Using contexts you can precisely control under what circumstances your
new word definitions/syntactic structures become affective, without
impacting REBOL's default vocabulary and behaviour.
For example:
print HTML/Dialect [
; dialect code here
head [Title "My title"]
body [] [H1 Title]
]
print head "123"
Note different uses of 'Title and 'head, in above REBOL code.
> 4. Based on contexts you can freely mix REBOL's default behaviour and any
number of dialects.
Or even embed many dialects in one all encompassing dialect.
> Example: See the CID dialect that is shipping REBOL/View beta.
>
> Hope this helps,
I hope this helps! :-)
Andrew Martin
Inventing the future...
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-