"DEFVAR and DEFPARAMETER do the combined service of
- in some implementations, recording the "definitional home" of the variable - declaring the indicated variable special in compiler and runtime - assigning the variable (either conditionally, as in DEFVAR, which assigns only in the case that the variable is unbound, or unconditionally, as in DEFPARAMETER). "
K. Pitman, comp.lang.lisp, 26. April 2001.
What "recording the definitional home" means? Why "in some implementations?"
Kazimir Majorinc kazimir@chem.pmf.hr writes:
"DEFVAR and DEFPARAMETER do the combined service of
- in some implementations, recording the "definitional home" of the
variable
- declaring the indicated variable special in compiler and runtime
- assigning the variable (either conditionally, as in DEFVAR, which
assigns only in the case that the variable is unbound, or unconditionally, as in DEFPARAMETER). "
K. Pitman, comp.lang.lisp, 26. April 2001.
Why "in some implementations?"
Because this is something that is just not specified.
What "recording the definitional home" means?
It's recording that the variable is defined in that file, at that position, so that you the "IDE" may jump to the definition of the variable to inspect it or modify it.
There's an additionnal service that's specified:
- record the variable documentation for that symbol.
On Sat, 26 Mar 2011, Kazimir Majorinc wrote:
"DEFVAR and DEFPARAMETER do the combined service of
- in some implementations, recording the "definitional home" of the
variable
- declaring the indicated variable special in compiler and runtime
- assigning the variable (either conditionally, as in DEFVAR, which
assigns only in the case that the variable is unbound, or unconditionally, as in DEFPARAMETER). "
K. Pitman, comp.lang.lisp, 26. April 2001.
What "recording the definitional home" means? Why "in some implementations?"
Without seeing the context, I read a couple things into this.
- source location for stuff like M-. - compilation unit which creates memory for and initializes the variable
Later, Daniel
On Mar 25, 2011, at 9:36 PM, Kazimir Majorinc wrote:
"DEFVAR and DEFPARAMETER do the combined service of
- in some implementations, recording the "definitional home" of the
variable ...
That reminds me; I desire an implementation independent library that abstracts out the recording of the "definitional home."
On Mon, 2011-03-28 at 09:57 -0400, Ben Hyde wrote:
On Mar 25, 2011, at 9:36 PM, Kazimir Majorinc wrote:
"DEFVAR and DEFPARAMETER do the combined service of
- in some implementations, recording the "definitional home" of the
variable ...
That reminds me; I desire an implementation independent library that abstracts out the recording of the "definitional home."
That's part of Slime
Stelian Ionescu wrote:
On Mon, 2011-03-28 at 09:57 -0400, Ben Hyde wrote:
On Mar 25, 2011, at 9:36 PM, Kazimir Majorinc wrote:
"DEFVAR and DEFPARAMETER do the combined service of
- in some implementations, recording the "definitional home" of the
variable ...
That reminds me; I desire an implementation independent library that abstracts out the recording of the "definitional home."
That's part of Slime
Please look at Conium. http://gitorious.org/conium#more
David Lichteblau had the right idea: This functionality needs to be broken out of Slime and made available as a general toolset.
- Daniel
Can you explain a bit what you mean by this?
On 3/28/2011 9:57 AM, Ben Hyde wrote:
On Mar 25, 2011, at 9:36 PM, Kazimir Majorinc wrote:
"DEFVAR and DEFPARAMETER do the combined service of
- in some implementations, recording the "definitional home" of the
variable ...
That reminds me; I desire an implementation independent library that abstracts out the recording of the "definitional home."
pro mailing list pro@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/pro
On Mar 28, 2011, at 11:14 AM, Mark H. David wrote:
Can you explain a bit what you mean by this?
My example. Say I have a macro for defining widgets and I use it I define cool-widget on line N of file foo.lisp like so:
(define-widget cool-widget ...)
In the wonderful world which is my imagination I should be able to meta-dot the symbol cool-widget and shortly there after find my self visiting line N of foo.lisp.
This presumes that each implementation supports the concept of definition homes for - a mapping from keys of some sort (typically a symbol) to source location(s). The author of define-widget would add entries to that mapping. The IDE (slime say) would query that mapping.
The author of define-widget might write something like so:
(defmacro define-widget (name ...) ... `(progn (take-note-of-definitional-home ,name ... :widget ...) ...))
The kind implementor of the 'implementation independent library that abstracts out the recording of the "definitional home"' would know how to map the arguments to take-note-of-definitional-home into something that actually adds/revises an entry into the implemenation's mapping.
It would be a wonderful world, yes it would.
- ben
Yeah, that would be great. We had a bit of a discussion of this sort of functionality on the slime-devel mailing list. Nobody had any easy answers, even for just SBCL and CCL, which I would have settled for. It was also pointed out that there's a basic first level of functionality, permitting meta-. to work. Then, the next level preserves source location of subforms of a body of Lisp code to support "PC to Source" mapping. This doesn't seem all that hard to do at least a first-level version, at least with the stuff SLIME can already do. And then encapsulating it in a Library would be great. Excellent library candidate. Hope someone will do this -- it will be really worthwhile and make a lot of developers happy.
On 3/28/2011 3:10 PM, Ben Hyde wrote:
On Mar 28, 2011, at 11:14 AM, Mark H. David wrote:
Can you explain a bit what you mean by this?
My example. Say I have a macro for defining widgets and I use it I define cool-widget on line N of file foo.lisp like so:
(define-widget cool-widget ...)
In the wonderful world which is my imagination I should be able to meta-dot the symbol cool-widget and shortly there after find my self visiting line N of foo.lisp.
This presumes that each implementation supports the concept of definition homes for - a mapping from keys of some sort (typically a symbol) to source location(s). The author of define-widget would add entries to that mapping. The IDE (slime say) would query that mapping.
The author of define-widget might write something like so:
(defmacro define-widget (name ...) ... `(progn (take-note-of-definitional-home ,name ... :widget ...) ...))
The kind implementor of the 'implementation independent library that abstracts out the recording of the "definitional home"' would know how to map the arguments to take-note-of-definitional-home into something that actually adds/revises an entry into the implemenation's mapping.
It would be a wonderful world, yes it would.
- ben
On Mon, Mar 28, 2011 at 10:24 PM, Mark H. David mhd@yv.org wrote:
Yeah, that would be great. We had a bit of a discussion of this sort of functionality on the slime-devel mailing list. Nobody had any easy answers, even for just SBCL and CCL, which I would have settled for. It was also pointed out that there's a basic first level of functionality, permitting meta-. to work. Then, the next level preserves source location of subforms of a body of Lisp code to support "PC to Source" mapping. This doesn't seem all that hard to do at least a first-level version, at least with the stuff SLIME can already do. And then encapsulating it in a Library would be great. Excellent library candidate.
I think it would be best done by implementers (a CDR?) rather than being a library, since it interferes quite deeply with the reader. I agree that doing the first level is not hard; the next level is not hard either, conceptually - but since you can't have the reader record all the subforms when you're only interested in a few of them, you'd need some way to mark the forms you're interested in, e.g.
#.(reader:record-next-form (form file line column) (setf (get 'some-symbol 'some-property) (list form file line column))) (yadda-yadda-yadda)
-->
(progn (let ((form '#1=(yadda-yadda-yadda)) (file "foo.lisp") (line 123) (column 42)) (setf (get 'some-symbol 'some-property) (list form file line column))) #1#)
Or something like that.
Hope someone will do this -- it will be really worthwhile and make a lot of developers happy.
I'm not a SLIME hacker, but I'm a contributor to ABCL. I'm willing to experiment with the CL implementation side of this, to produce an API that SLIME and other clients could use. If I'll think I'm successful and if there will be enough interest and consensus, I could also propose it as a CDR.
Cheers, Alessio
On 28/03/2011, at 15:57, Ben Hyde bhyde@pobox.com wrote:
On Mar 25, 2011, at 9:36 PM, Kazimir Majorinc wrote:
"DEFVAR and DEFPARAMETER do the combined service of
- in some implementations, recording the "definitional home" of the
variable ...
That reminds me; I desire an implementation independent library that abstracts out the recording of the "definitional home."
That starts with a lisp reader, or at least an implementation dependant API to collect the file position of each lisp object read.
On 28/03/2011, at 15:57, Ben Hyde bhyde@pobox.com wrote:
On Mar 25, 2011, at 9:36 PM, Kazimir Majorinc wrote:
"DEFVAR and DEFPARAMETER do the combined service of
- in some implementations, recording the "definitional home" of the
variable ...
That reminds me; I desire an implementation independent library that abstracts out the recording of the "definitional home."
That starts with a lisp reader, or at least an implementation dependant API to collect the file position of each lisp object read.
The Conium project looks like a good place for that sort of thing. http://gitorious.org/conium#more
- Daniel
- Ben Hyde oulqr@cbobk.pbz [2011-03-28 09:57:40 -0400]:
On Mar 25, 2011, at 9:36 PM, Kazimir Majorinc wrote:
"DEFVAR and DEFPARAMETER do the combined service of
- in some implementations, recording the "definitional home" of the
variable ...
That reminds me; I desire an implementation independent library that abstracts out the recording of the "definitional home."
I am afraid this would be quite hard to do: imagine a variable defined in different files for different implementations and features.
On the other hand, it you are willing to compromise on implementation independence, you can use slime: I believe they support many implementations (each implementation has its own internal idiosyncratic way to remember where a variable is defined, and they abstract that out into a common interface).