Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> So this is more functionality of the environment / tools, rather then the compiler or language.

Doesn't FUNCTION-LAMBDA-EXPRESSION apply here?



Didn't even know about this one. It is one of those 'optional' features -- the standard puts it like "Any implementation may legitimately return nil as the lambda-expression of any function." And indeed, CCL choses to do just that. SBCL seems to put in some effort to decompile the function.


Worst case scenario, you can probably patch your compiler's COMPILE function to store the data somewhere before performing the actual compilation.

As for CCL, it seems to work for me just fine as long as you set CCL:*SAVE-DEFINITIONS* to T:

    Clozure Common Lisp Version 1.12.1 (v1.12.1) LinuxX8664

    For more information about CCL, please see http://ccl.clozure.com.

    CCL is free software.  It is distributed under the terms of the Apache
    Licence, Version 2.0.
    ? (defun foobar (a b c) (* a (+ b c)))
    FOOBAR
    ? (function-lambda-expression #'foobar)
    NIL
    NIL
    FOOBAR
    ? (setf ccl:*save-definitions* t)
    T
    ? (defun foobar (a b c) (* a (+ b c)))
    FOOBAR
    ? (function-lambda-expression #'foobar)
    (LAMBDA (A B C) (DECLARE (CCL::GLOBAL-FUNCTION-NAME FOOBAR)) (BLOCK FOOBAR (* A (+ B C))))
    NIL
    FOOBAR


CCL has a feature called source-note to record locations and source.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: