[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
m-v on conventional machines
- To: common-lisp@su-ai
- Subject: m-v on conventional machines
- From: UCBERNIE.jkf@Berkeley (John Foderaro)
- Date: Sun, 14 Nov 1982 15:54:00 -0000
I too must disagree with Moon's statement that m-v's are free on
conventional machines if the user doesn't use them:
1) You must put a special mark on the stack for every tail recursive
call, whether you plan to use m-v's or not. This is not free on
conventional machines, and tail recursive calls happen often.
2) Lisps on conventional machines often have a mode which permits rapid
execution at the price of losing the ability to interpret the stack's
contents. Since a m-v return requires being able to go back on the
stack to find a possible m-v-b, such rapid execution modes would
have to be forbidden, causing grief to those users who don't care
about m-v's. The difficulty of interpreting the stack's contents
on conventional machines is compounded by the fact that the operating
system often dumps data on the stack (during interrupts for example) and
your lisp system will have to make sure that it ignores those stack
frames. Also, if you run multiple languages inside your lisp, then
you will have stack frames whose form you have no way of predicting in
advance.
As an exercise in futility, I will express my feelings on what m-v's should
do:
m-v's should be a protocol for passing multiple values from callee to
caller. If the caller does a m-v call and the last thing executed before
returning to the caller does a values, then the values will be transfered
back. All other cases are undefined!!!!! Like everything else in lisp, if
the user does something illegal it is his own fault and the system may or
may not catch it (depending on how expensive the checks are on a given
machine). In a lisp on a conventional machine, the best place to check for
things like this
(multiple-value-list (progn (values 'a 'b 'c) nil)) --> (nil b c)
is not at runtime, but at compile time (or by using a special program which
does extensive type analysis of the source code). Thus, since the above
example is illegal, its result is undefined, and so (nil b c) is as good a
value as any to return.