Just try to imitate the behaviour of this library in your favorite language. I tried in Tcl, simulating macros with upvar, uplevel and even with sugar and is not easy to get the same result.
(define (whitepage . content)
`(html (body ,@content)))
(define (para)
`(p))
(define (link prose url)
`(a ((href ,url)) ,prose))
(define (prbold text)
`(strong ,text))
So the example from the Arc link (whitepage "Hello world!" (para) (link "Click here" "http://news.ycombinator.com")
"for" (prbold "more stuff"))
yields (html
(body
"Hello world!"
(p)
(a ((href "http://news.ycombinator.com")) "Click here")
"for"
(strong "more stuff")))
which is a valid expression that PLT's web server will render as a web page.Okay...I'll leave my "Are we getting anything" question there, but it probably shouldn't be answered. Or at least not here. It's essentially the pure-functional versus side-effect debate. To be fair, you get benefits from both, and both have downsides that the others are better at.
When looking at PG's approach in ACL, it's worth remembering that he came up with it more than 10 years ago, and consider it in that context. The surrounding ecosystem for web development was a lot more primitive back then (which serves to highlight how impressive his idea is/was).
(= a 1)
(whitepage (= b (+ a 1)) (pr b))
And you obtain: <html><body bgcolor=#ffffff alink=#0000be>2</body></html> (mac uvar (u k) `((profs* ,u) ',k))
(def user-age (u) (hours-since (uvar u created)))
Without a macro you'd have to call uvar like: (uvar u 'k). For this example I'd favor 'k because it makes the behavior clearer.(Did you mean uvar instead of upvar?)