Hi Alan,
On Wed, Jan 6, 2010 at 5:35 AM, Alan Ruttenberg alanruttenberg@gmail.com wrote:
On Tue, Jan 5, 2010 at 5:48 PM, Alan Ruttenberg alanruttenberg@gmail.com wrote:
(BTW, I don't see why there would be an actual function created here - should be optimized away)
I've had a go at implementing the optimization
That's great!
([funcall] (lambda(a b [&rest c]) ...) p q [r s ...]) -> (let ((a p) (b q) (c (list r s ...))) ...)
http://svn.mumble.net:8080/svn/lsw/trunk/patches/optimize-lambda.lisp
I don't know if it's in the proper place in the compiler. I've compiled my code in 0.18 trunk using it and I haven't run into problems. It triggers some bug in my old version of ABCL (problem loading a class file!) but I don't think it's worth investigating that so I disable it in that version.
I can see the error shown by the symbol-macrolet in the precompiler sources:
572 (defun precompile-lambda (form) 573 (let ((body (cddr form)) 574 (precompiled-lambda-list 575 (precompile-lambda-list (cadr form))) 576 (*inline-declarations* *inline-declarations*)) 577 (process-optimization-declarations body) 578 (list* 'LAMBDA precompiled-lambda-list 579 (mapcar #'precompile1 body))))
Before going on to process the lambda body statements in line 579, precompile-lambda should establish variables from the lambda list shadowing the symbol-macrolet...
Bye,
Erik.