[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
free variable references in interpreter.
I disagree with what GJC said, because of the reasons Soley gave, but I
disagree with Soley's counter on aesthetic reasons. Suppose there were
a magic switch. What would the end of GETHASH look like?
(return-from gethash
(if *pure-cl*
(values entry got-it-p)
(values entry got-it-p key-stored-in-hash-table)))
That doesn't appeal to me, and neither does
(multiple-value-call #'values
(values entry got-it-p)
(if *pure-cl* (values) (values key-stored-in-hash-table)))
I suppose this could be packaged as macros, but then I ask you: is it
reasonable for people to have to bind *pure-cl* to NIL (presumably it
has to default to to) in order to get extra values? How is this really
different from GJC's request-is-via-optional-arguments-on-the-call-side?
A couple more random points of information. I think multiple-value-call
is a poor name. It should be called multiple-value-funcall. The
symbolics system has a special form called sys:%multiple-value-call-n
which looks like
(sys:%multiple-value-call-n fun vals1 n1 vals2 n2 ...)
which is more-or-less a highly optimized
(multiple-value-call #'fun
(multiple-value-bind (v1 v2 ... vn1)
vals1
(values v1 v2 ... vn1))
(multiple-value-bind (v1 v2 ... vn2)
vals2
(values v1 v2 ... vn2))
...)
In other words, fun is unquoted (for esoterit historical reasons I can
never remember), and the pairs of values-count say effectively "evaluate
valsM for nM values." This win about this special form is that it is
insensitive to extra values because the caller explicitly says how many
values are requested.