Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.lisp > #32992
| From | "Pascal J. Bourguignon" <pjb@informatimago.com> |
|---|---|
| Newsgroups | comp.lang.lisp |
| Subject | Re: new functions defined list |
| Date | 2019-05-29 20:40 +0200 |
| Organization | Informatimago |
| Message-ID | <m2v9xt14v7.fsf@despina.home> (permalink) |
| References | (1 earlier) <agX5cNkPaSHiCHjuz4pOQW6J1fws4@bongo-ra.co> <ea5d4de3-5795-462a-b037-a2c6fb243bce@googlegroups.com> <m2muj630ct.fsf@despina.home> <gX5cNkPaSHiCHjuz4pOQW6J1f5@bongo-ra.co> <20190529100309.66@kylheku.com> |
Kaz Kylheku <847-115-0292@kylheku.com> writes: > On 2019-05-28, Spiros Bousbouras <spibou@gmail.com> wrote: >> On Tue, 28 May 2019 20:22:42 +0200 >> "Pascal J. Bourguignon" <pjb@informatimago.com> wrote: >>> Sai Sai <sairussuria@gmail.com> writes: >>> >>> > There should be a function that return the functions loaded from a file. >>> >>> No, there should not. It is useless. >> >> It's not useless , one might want to know for general information if nothing >> else. > > It's not useless, but consider, in the light of how long Lisp has been > around, that a beginner asked about such a feature in 2019. > > What might be useful is a utility that analyzes a file (either a > compiled .fasl or a source file) without actually loading it, and > produces a data structure that lists the symbols defined in > that file (and perhaps ones that are not defined, but referenced) > along with other info: what kind of thing they refer to and such. > > In the C-on-POSIX world, we can inspect object files with "nm", for > instance. I wrote it useless, because: 1- it's incomplete, because of the nature of lisp. I would guesstimate that at least half the functions used in a lisp program come from a definite source file location; an explicit defun or defmethod form. Also notice already that defmethod doesn't define functions so the request itself is ill-defined, and you will have a lot of work to define it correctly. Toplevel form wouldn't cut it, you would want to find the source of anonymous functions too, why not. A lot of operators are defined with macros that define several of them (defstruct, defclass), and even worse, for application defined macros. But also, a number of functions won't even be defined at compilation-time, but rather at load-time or at run-time. 2- it just doesn't work. Basically, 75% of the time, when I M-. on an operator, it jump to a source file where there's a toplevel macro calling a function that uses macros to generate code, and I would still have to know the structure of the project, the files and the macros used to define it. 3- it should not be needed. More precisely here is a criticism of the file system as persistent storage for code. Consider a system similar to the Smalltalk browser (something like it could be implemented in emacs for code (lisp, C, etc)), where you would give a command to create a new (toplevel) object (package, type, variable, function, method, etc). A window would open to let you edit it, and when you save the window, emacs (the IDE) itself would decide where to store it (in a database, in a file system, in which file, etc). You would and should not have to think about where to store your forms in files. For all you know, the system could just store the forms in a database or in a lisp image. Implementing such a user interface could be a first step in being actually able to free us from the hierarchical file system. (The other step would be to implement GIT in a lisp image, to be able to use it without going thru the file system, there's already some cl-git system IIRC). 4- it's useless as a standalone tool, for the above reasons, but also, because implementations and tools already implement what they can about it to provide the M-. or (v in sldb) feature to jump to the source code, when it's possible (which is not often). Notably, some documentation tools try to locate source forms, but they can only do it very partially. I wouldn't count on them. You need to read the source, and to inspect a lisp image, to learn about it and know (and document) what is implemented. Or try to implement hacks like the code I provided, which answers literally to the question, and beyond, but again, which won't be used much more after having being written and tested, hence the "useless" qualifier. -- __Pascal J. Bourguignon__ http://www.informatimago.com
Back to comp.lang.lisp | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
new functions defined list Sai Sai <sairussuria@gmail.com> - 2019-05-28 07:10 -0700
Re: new functions defined list "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-05-28 19:35 +0200
Re: new functions defined list Sai Sai <sairussuria@gmail.com> - 2019-05-28 10:45 -0700
Re: new functions defined list Spiros Bousbouras <spibou@gmail.com> - 2019-05-28 18:00 +0000
Re: new functions defined list Spiros Bousbouras <spibou@gmail.com> - 2019-05-28 17:50 +0000
Re: new functions defined list Sai Sai <sairussuria@gmail.com> - 2019-05-28 11:01 -0700
Re: new functions defined list Sai Sai <sairussuria@gmail.com> - 2019-05-28 11:12 -0700
Re: new functions defined list "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-05-28 20:22 +0200
Re: new functions defined list Spiros Bousbouras <spibou@gmail.com> - 2019-05-28 19:20 +0000
Re: new functions defined list "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-05-28 21:53 +0200
Re: new functions defined list Spiros Bousbouras <spibou@gmail.com> - 2019-05-28 20:34 +0000
Re: new functions defined list paul wallich <pw@panix.com> - 2019-05-28 21:03 -0400
Re: new functions defined list Kaz Kylheku <847-115-0292@kylheku.com> - 2019-05-29 17:09 +0000
Re: new functions defined list "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-05-29 20:40 +0200
Re: new functions defined list Madhu <enometh@meer.net> - 2019-05-29 06:43 +0530
Re: new functions defined list rpw3@rpw3.org (Rob Warnock) - 2019-05-31 15:50 +0000
Re: new functions defined list paul wallich <pw@panix.com> - 2019-05-28 14:28 -0400
Re: new functions defined list Sai Sai <sairussuria@gmail.com> - 2019-05-28 11:53 -0700
Re: new functions defined list Spiros Bousbouras <spibou@gmail.com> - 2019-05-28 19:07 +0000
Re: new functions defined list taruss@google.com - 2019-05-28 15:10 -0700
Re: new functions defined list smh <shaflich@gmail.com> - 2019-05-29 04:00 -0700
Re: new functions defined list "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-05-28 20:13 +0200
Re: new functions defined list taruss@google.com - 2019-05-29 11:46 -0700
csiph-web