> Stephen knows this stuff better than I, but I know that we talked a lot to > Richard about his experiences with full CPS conversion and I know that the > notion of using CPS to express the intra-procedural flow was from him. At > the time I was arguing for the advantages of CPS (over direct style) and I > remember showing an example from Shiver's thesis where top-level procedures > were transformed into continuations (because they always were called with the > same continuation). I think that Stephen put contification into MLton in > response to that. (Although it might have waited until he saw that this was > going to be required for nested loops, as in matrix multiplication.) That all sounds right. I remember the most annoying problem that we had with the direct style IL was that we were allocating tuples for code like the following: val (x, y) = if ... then (a, b) else (c, d) This was absolutely killing us in some benchmarks. We could have gone to some variant of a direct style IL that allowed a "flat" tuple to be returned in the branches of the if, but it was so much easier to go to CPS with multi-argument continuations and do: fun L (x, y) = ... if ... then L (a, b) else L (c, d)