4 ms·
Do you mind enumerating what those systems are? I've only played around with Allegro CL and SBCL myself.
by dmux 4y ago
Do you mind enumerating what those systems are? I've only played around with Allegro CL and SBCL myself.
- guenthert 4y agoMaybe collectively we can. In Emacs/SLIME/CCL,SBCL on ARM32,x86-64 ESC + '.' (command 'find-tag') on a symbol in the REPL opens a buffer with the definition of that symbol, provided you have the sources (it's neither decompiling nor reading the definition from the binary, but follows a hint to the source file). So this is more functionality of the environment / tools, rather then the compiler or language. Works beautifully though and in most cases you don't really want the sources embedded within the binary.
- jhgb 4y ago> So this is more functionality of the environment / tools, rather then the compiler or language. Doesn't FUNCTION-LAMBDA-EXPRESSION apply here?
- guenthert 4y agoDidn'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.
- lispm 4y agoCCL has a feature called source-note to record locations and source.
- jhgb 4y agoWorst 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
- draven 4y agoNot a Common Lisp implementation but Clojure can find the source for a symbol (provided the source code file is in the classpath) with the clojure.repl/source function (doc: https://clojure.github.io/clojure/clojure.repl-api.html#clojure.repl/source https://clojure.github.io/clojure/clojure.repl-api.html#cloj... .) All development environments support jump to definition.
- lispm 4y agoLispWorks for example has a documented and extensible mechanism to record the locations of definitions: http://www.lispworks.com/documentation/lw80/lw/lw-dspecs-ug.htm http://www.lispworks.com/documentation/lw80/lw/lw-dspecs-ug.... Common Lisp has standard function FUNCTION-LAMBDA-EXPRESSION: * (defun foo (a) (my-if (> a 10) 'big 'small)) FOO * (function-lambda-expression #'foo) (LAMBDA (A) (BLOCK FOO (MY-IF (> A 10) 'BIG 'SMALL))) T FOO