wanted: FUNCTION-LAMBDA-EXPRESSION to a lambda for all notinline functions as well

Bug #560977 reported by Roman Marynchak
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Wishlist
Unassigned

Bug Description

It will be nice to make FUNCTION-LAMBDA-EXPRESSION more informative someday (however, this is not required in CLHS, so this issue should be of low priority). To feel the difference, compare the output in SBCL:

(defun h() (format T "Hi there"))

(function-lambda-expression #'h) => (NIL T H)

with the output from CLISP:

[1]> (defun h() (format T "Hi there"))
H
[2]> (function-lambda-expression #'h)
(LAMBDA NIL (DECLARE (SYSTEM::IN-DEFUN H)) (BLOCK H (FORMAT T "Hi there"))) ;
#(NIL NIL NIL NIL ((DECLARATION XLIB::CLX-VALUES VALUES OPTIMIZE DECLARATION))) ;
H
[3]>

So, SBCL gives NIL instead of the function's lambda expression.

Regards,
Roman

Revision history for this message
Attila Lendvai (attila-lendvai) wrote :

would also be useful for the partial evaluator Levente is working on... ( http://dwim.hu/project/hu.dwim.partial-eval )

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

FUNCTION-LAMBDA-EXPRESSION returns the lambda expression if SBCL has access to it -- which is the case for inlined functions.

For others saving the lambda-expression has historically been deemed too costly in terms of space.

That said, it may be time to revisit that assumption, or possibly add a parameter or declaration to control source-saving. (Or use an external source database.)

Changed in sbcl:
importance: Undecided → Wishlist
status: New → Triaged
summary: - wanted: FUNCTION-LAMBDA-EXPRESSION should return a valid lambda
+ wanted: FUNCTION-LAMBDA-EXPRESSION to a lambda for all notinline
+ functions as well
Revision history for this message
Douglas Katzman (dougk) wrote :

file try.lisp:
(defun try (x)
  (declare (optimize (sb-c:store-source-form 3)))
  `((zook ,x)))

* (load (compile-file "try.lisp"))
* (function-lambda-expression #'try) =>
(LAMBDA (X)
  (DECLARE (SB-C::TOP-LEVEL-FORM))
  (DECLARE (OPTIMIZE (SB-C:STORE-SOURCE-FORM 3)))
  (BLOCK TRY `((ZOOK ,X))))

Changed in sbcl:
status: Triaged → Fix Committed
Stas Boukarev (stassats)
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.