More on the "handle ... with ..." construct
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
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.
Posted by: Philip Wadler | October 20, 2005 11:49 AM
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.
Posted by: ezra | October 20, 2005 12:51 PM