[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ARGUMENTS/VALUES -> CONSUME/PRODUCE
Date: Fri, 8 Sep 89 09:43:24 PDT
From: Norman Adams <firstname.lastname@example.org>
Or CONTINUE and RETURN. This has gone on long enough that I have lost
any perspective about what good names would be. Aren't most people
going to CALL-WITH-VALUES via some syntactic extension anyway? If so,
a good but long name is OK.
Actually, CONTINUE seems to me to be the right name for VALUES, not
Consider the precedent in Fortran: it is a near no-op, whose only
purpose in life is to provide a syntactic way of attaching a label. By
analogy, the purpose of VALUES is only a syntactic device to provide a
way of shoehorning two value producing expressions in a place where only
one would otherwise fit. (Further, consider that in FORTRAN, CONTINUE
takes zero arguments, and then returns to its continuation, which is not
expecting any arguments. So the usages are even compatible. :-)
Getting back to Scheme, though, CONTINUE has the properties I want which
VALUES does not of being agnostic about the number of values. It also
has the property I want that RETURN does not, of not wrongly suggesting
an imperative transfer of control. It suggests that the evaluator will
go about business as usual, but with N values instead of the usual one.
For CALL-WITH-VALUES, I suggest the name should be
(CALL-WITH-CONTINUATION fn continuation)
where the idea would be to think of the second function as effectively
promoted to the status of a continuation. (When that continuation `runs out,'
the current continuation receives its values.)
(CALL-WITH-CONTINUATION (LAMBDA () (CONTINUE 1 2)) CONS)
=> (1 . 2)
I think this has a very nice look to it.