01 Feb 2008
Been poking around the Arc site; I did a quick Vim integration (to allow sending files/forms to the running Arc process), and I’ve been reading its code a little, mostly to get a better understanding of the approach it’s taking for html generation.
There’s bad and good, but it’s certainly very terse. Here’s the Arc version of prompt, interstitial, and results:
(defop said req (aform [w/link (pr "you said: " (arg _ "foo")) (pr "click here")] (input "foo") (submit)))
I’d written a Python library that makes things pretty terse (there’s an example on that page), but after seeing the Arc version, I wanted to trim it down some more. It now looks like:
@op def said(req): def result(foo): cede(link("you said: " + foo, "click here")) cede(aform(result, input("foo")))
There’s a bit of magic going on, but it’s quite nice and tidy I think. Compared to the Arc version, I prefer having
foo as a regular argument to the handler function vs
(arg _ foo) in Arc, but the simpler closures in Arc allow you to avoid
cede and the name
result which is a little nicer. It’s pretty close to a direct translation which I find interesting. I’ll definitely be keeping an eye on Arc as it develops, I found this an expanding experience.