[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiple return values



Will:
    I see no way to implement the proposed procedures in R3RS Scheme, but
    most implementations should find it easy to add them.

Jonathan:
  If "wrong" doesn't imply "signals an error" then the following is a
  correct implementation of alternative 1.  This is pretty much how the
  feature was implemented in T2....

Unfortunately, Jonathan's simple implementation of receive-values and
return-values doesn't quite work: (list 1 (return-values 2) 3) is
supposed to evaluate to (1 2 3) but with Jonathan's implementation it
evaluates to (1 (values-marker 2) 3).  The problem is that RETURN-VALUES
doesn't know whether it is returning to a continuation created by
RECEIVE-VALUES or to an "ordinary" continuation.  The simplest correct
implementations I've been able to imagine require that one machine
instruction be added to the standard continuation invocation sequence
(i.e. returns from closed-coded non-tail-recursive calls).

Peace, Will