Decode this bug

Stephen Weeks sweeks@intertrust.com
Sun, 12 Dec 1999 13:05:47 -0800 (PST)


> Can you explain how the direct expect interface handles multiple return
> values?

It does not expose the fact that Cps functions have multiple return
values.

> Do I just return a tuple ala ML and expect it to work.

Yes, with the direct interface.  Other passes that operate directly on 
Cps must be aware of multiple return values (as seen in the returns of 
a function declaration and the Return transfer).

> Are detuple
> and detupleBind there to handle multiple returns?

No.  They are there to destructure tuples.  The only difference
between the two is that detuple creates new variable names for the
tuple components whereas detupleBind takes the variables to be bound
to the components.

Multiple return values are handled by having the jump in a Call
transfer be SOME j, where j is an n-ary local function.

> Can I just think of functions as always just returning and taking tuples?

Returns yes.  Args no.  DrectExp.call takes a list of args, and thus
exposes the fact that Cps functions are n-ary.  You could always use a 
single arg, and rely on other passes to flatten it out, though.