[MLton] handling a variable number of arguments in SML

Matthew Fluet fluet@cs.cornell.edu
Wed, 24 Aug 2005 08:13:22 -0400 (EDT)


> In the list approach, "a X" and "b Y" must have the same type.  In the
> composition approach, we only require that they compose to the
> appropriate type.  I'm not clear if this generality is useful, but it
> may be.  In the CPS approach, we have even more flexibility, since we
> can play tricks with the continuation.  For example, we could require
> a strict alternation between two different kinds of arguments.

Another trick that I believe you can play is to use phantom types in the 
continuations to prevent setting the same default argument more than once. 
This should be a variation on the "Linearity of attributes" technique 
described in:

@inproceedings{r:elsman04,
   author="M. Elsman and K. Larsen",
   title="Typing {XHTML} {Web} Applications in {ML}",
   booktitle=padl04,
   series=lncs,
   volume=3350,
   publisher=springer,
   pages="224--238",
   year=2004}