[iterate-devel] Iterate error with multiple-value-setq
Hoehle, Joerg-Cyril
Joerg-Cyril.Hoehle at t-systems.com
Fri Nov 26 13:50:14 UTC 2004
Hi,
Stonewall Ballard wrote:
>> A) I can't find m-v-BIND-call in the expansion. Is there a typo?
>No. I don't know where it is, or what it is. Describe says it has no
>bindings of any sort.
>> B) Could you please try out the following:
>After those changes, compiling:
>(defun test-iter (a b)
> (iter (repeat 4)
> (multiple-value-setq (a b) (foo))))
>Warning: Iterate, in clause (LET* NIL (MULTIPLE-VALUE-BIND (G3378
>G3379) (FOO) (LET* NIL (VALUES (SETQ A G3378) (SETQ B G3379))))):
>Unknown special form (MULTIPLE-VALUE-BIND-CALL (FUNCTION (LAMBDA
>(&OPTIONAL G3378 G3379 &REST EXTRA-VALS3380) (DECLARE (IGNORE
>EXTRA-VALS3380) (WEAK-LAMBDA-NAME DUMMY-LAMBDA)) (LET* NIL (VALUES
>(SETQ A G3378) (SETQ B G3379))))) (FOO)) -- won't be walked by Iterate
>
>BTW, this fails in exactly the same way if I use (setf (values a b)
>(foo)) instead of m-v-setq.
o It would be nice to know how this m-v-BIND-call appears out of the blue.
Does it happen in interpreted and/or compiled mode? Could you trace iter::walk, cl:macroexpand and also cl:macroexpand-1?
o It seems to me like Lispworks is not conformant. The CL idea is that user code must be able to walk foreign code, therefore macroexpansions must be available for all but the fixed set of special operators that CL defines.
o Could you provide output for
(macroexpand-1'(multiple-value-setq (a b) (foo)))
(macroexpand-1'(setf (values a b) (foo)))
(macroexpand-1'(multiple-value-bind (x y) (foo) (setq a x b y)))
o I feel like little is possible about this issue except to (selectively?) shut up the warning message.
o what's m-v-bind-call home package?
o Portable Iterate should IMHO continue to recognize the case of an unknown (and therefore IMHO violating ANSI) special operator. The open issue is what to do. It could either be treated as a function call and walked accordingly, or left untouched. The latter is conservative, probably safer, but may miss clauses, and it's what the current code does.
o What't the value of
(let (a b) (list (multiple-value-list
(multiple-value-setq (a b) (values 1 2 3))) a b))
It should be
((1) 1 2)
but the Iterate message above suggests it could be ((1 2) 1 2)?!?
o Finally, are you sure my changes were executed? iter::walk-multiple-value-bind should have been executed, while the output suggests that a LW-specific expansion was used instead, introducing m-v-BIND-call, a lambda and &rest #:extra-vals3380.
What I mean is that the transformed clause
(LET* NIL (MULTIPLE-VALUE-BIND (G3378 G3379) (FOO) (LET* NIL (VALUES (SETQ A G3378) (SETQ B G3379))))) should be walked solely by Iterate's walk-xyz handlers, without further need for macroexpansion (except for (foo) and values).
Be aware that code may keep a reference to the original #'walk even when you replace WALK in the REPL later.
What do you think?
Jorg Hohle.
More information about the iterate-devel
mailing list