[REBOL] Re: Language-oriented programming
From: tim-johnsons::web::com at: 20-Sep-2007 12:05
On Thursday 20 September 2007, Ed O'Connor wrote:
> Language-oriented programming is interesting and caused a small stir a
> couple of years ago. Unfortunately, it hasn't gone anywhere,
:-) What about parse?
Common LISP has used the DSL approach for decades, I believe.
I don't have a lot of time to elaborate right now, but I must say that
rebol lends itself *very* well to dsl. I make a great deal of this approach
(dialecting), usually the dialect is sitting "on top off" an object.
A superb example of a dialect is Andrew Martin's ML dialect, which should
be available from rebol.org.
After using 'ML, one would never want to go back to using literal strings
or tags for emitting html for any large structure.
MTCW
Tim
Example below:
;; 'htm is a simple wrapper for 'ML, auto-composing any parens
content: htm[
form/action/method (.g/blog-url) "POST"[
table/border/cellpadding/cellspacing/width
0 2 1 "100%" [
tr[td/align "right"[b["Name:"]]
td/align "left"[input/type/name/value/size
"text" "name" "$name" "45"
]
]
tr[td/valign "top"[p/align "right" b[(brs 1)
"Comment: "]]
td[textarea/name/rows/cols "text" 8 58["$msg"]]
]
tr[ td/width 87[" "]
td[input/type/name/value "submit" "Cancel" "Cancel"
input/type/name/value "submit" (button-text)
(button-text)]
"$more"
]
tr[td/width/height 87 25[" "]
td[i["Note: HTML tags allowed for:" (tags-allowed)]]
] (newline)
input/type/name/value "hidden" "cmt" "$file"
]
]
]