Hi,
(compile nil (compile nil (lambda ()))) => NIL (compile '+) => +
The first result is obviously wrong, and the second one is actually as well (according to the HyperSpec, compile should return the function definition of +).
The fix is rather trivial:
Index: src/org/armedbear/lisp/compiler-pass2.lisp =================================================================== --- src/org/armedbear/lisp/compiler-pass2.lisp (revision 14055) +++ src/org/armedbear/lisp/compiler-pass2.lisp (working copy) @@ -7483,7 +7483,7 @@ (resolve name) ;; Make sure the symbol has been resolved by the autoloader (setf definition (fdefinition name))) (when (compiled-function-p definition) - (return-from jvm-compile (values name nil nil))) + (return-from jvm-compile (values definition nil nil))) (let ((catch-errors *catch-errors*) (warnings-p nil) (failure-p nil) Index: test/lisp/abcl/compiler-tests.lisp =================================================================== --- test/lisp/abcl/compiler-tests.lisp (revision 14055) +++ test/lisp/abcl/compiler-tests.lisp (working copy) @@ -472,11 +472,10 @@ (not (null result)))) t)
+(deftest compile-named + (compile '+) + (symbol-function '+))
- - - - - - - \ No newline at end of file +(deftest compile-compile + (compiled-function-p (compile nil (compile nil (lambda ())))) + t)
Happy hacking, Vladimir
On Aug 11, 2012, at 20:58, Vladimir Sedach vsedach@gmail.com wrote:
(compile nil (compile nil (lambda ()))) => NIL (compile '+) => +
The first result is obviously wrong, and the second one is actually as well (according to the HyperSpec, compile should return the function definition of +).
The second one is actually correct behavior (CLHS says "If a non-nil name is given, then the resulting compiled function replaces the existing function definition of name and the name is returned as the primary value").
Rudi
On Aug 11, 2012, at 20:58, Vladimir Sedach vsedach@gmail.com wrote:
Hi,
(compile nil (compile nil (lambda ()))) => NIL (compile '+) => +
The first result is obviously wrong, and the second one is actually as well (according to the HyperSpec, compile should return the function definition of +).
Thanks, #14087 should fix the return value for (compile nil ...). (The return value for compile with a named function was actually correct, at least per my reading of the hyperspec.)
Rudi
You're absolutely right, I wasn't paying very much attention when reading the Hyperspec.
Vladimir
On Tue, Aug 14, 2012 at 3:34 PM, Rudolf Schlatte rudi@constantly.at wrote:
On Aug 11, 2012, at 20:58, Vladimir Sedach vsedach@gmail.com wrote:
Hi,
(compile nil (compile nil (lambda ()))) => NIL (compile '+) => +
The first result is obviously wrong, and the second one is actually as well (according to the HyperSpec, compile should return the function definition of +).
Thanks, #14087 should fix the return value for (compile nil ...). (The return value for compile with a named function was actually correct, at least per my reading of the hyperspec.)
Rudi
armedbear-devel@common-lisp.net