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

multiple return values

The Common Lisp decision to allow additional return values to be silently
ignored when unreferenced is an interesting decision but it is certainly
not the only position that one can take.

The CL specification is muddied by having to explain that there are
different kinds of bound variable lists, some of which care how many
values are passed through and others of which do not. I would be sad if
Scheme went down this road.

I think that the Scheme community is in a unique position in being able
to see clearly the close relation between returning (invoking functions
which are continuations) and calling (invoking functions which are not
continuations). I think that in the long run it would be much more valuable
to the computer science community as a whole for us to explore the 
consequences of that close relation than it would be for us to be
gratuitously compatible with CL.

I think that great advantage in terms of static and dynamic error
checking can come from explicitly specifying when these values are to be
returned and when not. I think that continuations which take optional
or rest arguments are fine as long as they're notated as such. This 
protects people who want the error checking that comes from return
values being mismatched in number and who can afford to pay for that
checking. If we adopt a strategy which says that checking is illegal,
we're making it very hard for people to get checking.

I do agree with a subset of the worry that Alan expressed, though, which
is that (+ (F) 3) should work whether F is implemented by
 (LAMBDA () 4)
I don't think that:
needs to work, though. In fact, I think it should be permitted (and 
encouraged) to signal an error. I think some syntactic sugar could
easily make this palatable; eg, (+ (VALUE 0 (F)) 3)... or better
still, (+ (G) 3) where G was a function defined to do what I really
meant to be doing.