« Representing continuations | Main | Representable Continuations »

More on the "handle ... with ..." construct

Phil pointed out that this syntax doesn't do much different from what Links already does, where you can just embed a function call, using form fields as free variables.

I realized after talking to him that there's one thing this might allow, which is the treatment of multiple submit buttons in one form. Let's try an example where the search box has a "Search Species" button, to search some database of animal species, and a "Help" button to search a certain help database instead.

fun search_feature() {
    handle
       <form action="{handler}">
       <input name="search_term" />
       <input type="submit" name="submit" value="Search Species" />
       <input type="submit" name="submit" value="Help" />
       </form>
    with
      {submit="Search Species",search_term=term} -> species_search(term)
    | {submit="Help",search_term=term} -> search_help(term)

Here we're matching on specific values for the submit argument and both cases are binding the value of search_term to a variable.

With the other syntax, you could do this, but you'd have to write a glue function which does the pattern matching and dispatches to the right handler function. So, call it sugar, but call it nice sugar. . .

Comments

I think it would be better to just use a case branch on the value of submit in the action, then to add a whole new language feature.

If we did want to add a new language feature, I think the right thing would be to permit an l:action attribute on input elements with type submit as well as on form elements.

Phil,

My ultimate goal is to cleanly support the pipeline construct, that is

show user page A,
let the results be called R_A,
show user page B,
let the results be called R_B,
show user page C

This may not be the right way to do it, but limiting "continuations" to complete expressions, the way we do now, does not handle it very well.

I'm back
viagra
[url=http://www.pills-for-sale.info/buy-viagra.htm]viagra[/url]
viagra
[url=http://www.pills-for-sale.info/buy-viagra.htm]viagra[/url]
viagra
[url=http://www.pills-for-sale.info/buy-viagra.htm]viagra[/url]
viagra
[url=http://www.pills-for-sale.info/buy-viagra.htm]viagra[/url]
Best wihes

Hello
cialis
[url=http://pills-for-sale.info/cialis.htm]cialis[/url]
cialis
[url=http://pills-for-sale.info/cialis.htm]cialis[/url]
cialis
[url=http://pills-for-sale.info/cialis.htm]cialis[/url]
cialis
[url=http://pills-for-sale.info/cialis.htm]cialis[/url]
Bye

Post a comment