After thinking about the defun setf problem for a while, it turns out to be much more difficult than I initially suspected. At least I haven't thought of a way that doesn't involve consing.
What I did instead is to give up on the ordering guarantees of setf (accessor arguments evaluated before the new value form) and just put the new value form first in the signature.
Vladimir
2009/12/3 Vladimir Sedach vsedach@gmail.com:
- Recently, PS started putting curly braces around case blocks in switch
statements. It seems like this is unnecessary, at least in the examples I was looking at.
Which forms does SWITCH do this for? I thought I fixed that problem.
- When defining a setfable place as follows,
(ps (defun (setf blah) (a b) (whatever)))
and calling it as follows,
(ps (setf (blah c) d)))
PS insists on assigning the function arguments to temporarily variables before passing them to the function:
"var _js16974 = c; var _js16973 = d; __setf_blah(_js16973, _js16974);"
This makes me cringe. Is it really necessary? I'm thinking perhaps there's some weird case where you need to control evaluation differently, but it's obviously not doing so here.
C has to be evaluated before D. The problem is that C might be a whole bunch of parameters, including &rest and &optional and &key.
This actually exposes two things: in the simple case of a fixed argument signature, we can optimize the temporary variables away just by putting D last in the signature. The more serious problem is that I think &rest is broken for defun setf right now. I'll try to get both done.
I actually just thought of a third thing this exposes - reordering the argument signature would break (apply #'(setf ...) ...), but that doesn't work in PS right now either.
Vladimir
Daniel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel