Ways of Denoting Form Handlers
I've been exploring the idea of a "continuation" as the handler for an http request; to that end I have the Links interpreter working with serializable first class continuations, and an escape
construct for creating them. The code is finally in a stable state.
Having created one of these things, which effectively represents a control stack, the programmer can embed such an object in a web form, and posting the form passes the "value" of the form to that continuation.
In trying to program for it, I became convinced that using the escape
construct is very confusing. I think my handle ... with ...
, or something like it, would be much more natural. There are still some questions in my mind about that, as it still requires some notion of explicit continuation values, which I'd like to expunge. More on that later.
As an alternative, the Links programmer can specify an expression to be evaluated when the form is posted (as always). I call this feature the l:expression
feature and the other one the l:handler
feature. The difference is fairly subtle and I'm not yet sure how to explain the two; in fact each is as powerful as the other, but they have a difference of intention. With l:expression
, the coder is saying, "this expression represents the next page the user will see," whereas with l:handler
it's more like, "this handler will process the form and do more stuff, possibly showing many more pages, before dropping the user in a 'neutral' place." The l:handler
mode is more natural if you want to handle the form and then return to some dynamic context, for example if you want to display a page that acts like a subroutine, returning to whatever user experience it was invoked from.
It will require a lot more playing around to figure out good ways to present these and a real account of the pros and cons. Ping me if you're interested.