[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposed mildly incompatible change to MULTIPLE-VALUE(-BIND)
- To: lisp-forum at MIT-MC
- Subject: Re: Proposed mildly incompatible change to MULTIPLE-VALUE(-BIND)
- From: Guy.Steele at CMU-10A
- Date: Fri ,17 Apr 81 22:10:00 EDT
- Cc: Scott.Fahlman at CMU-10A
I would like to suggest that the procedure call and procedure return
interfaces be made more similar by means of the following slightly
incompatible change to MULTIPLE-VALUE and MULTIPLE-VALUE-BIND.
Recall that currently each of these takes a list of variables
and a form to evaluate; MULTIPLE-VALUE-BIND additionally has a PROGN-body.
Each evaluates the form, producing possibly multiple values;
the variables are then SETQ'd or bound, respectively, to the values.
Now, currently, if not enough values are supplied, then the extra variables
receive NIL, while if too many values are produced the excess ones are
I propose that the list of variables be completely identical in syntax
to a LAMBDA-list. This includes the use of &OPTIONAL and &REST. One
can get precisely the current functionality by inserting &OPTIONAL at
the front of the variables list. In addition, one would be able to get
non-NIL default values; a list of some of the values, using &REST;
and better error checking, because one can *require* that certain values
This is an incomatible change, but will screw only programs which depend
on the defaulting to NIL or the discarding of excess values. Such
programs are easily fixed by inserting &OPTIONAL or &REST IGNORE,
respectively. I suspect that most programs ask for exactly the number
of variables they are going to get, however, and so would be
unaffected but better error-checked.