freenode/#lisp - IRC Chatlog
Search
7:03:48
fiddlerwoaroof
Am I missing anything important in this? I'm trying to write a macro for running a single method of a generic function in isolation.
7:06:58
fiddlerwoaroof
Everything seems to work, I'm just wondering if I'm missing any subtle edge-cases
7:09:00
beach
Looks OK to me. Notice, though, as I pointed out the other day, that some classes of generic functions may use a different signature for its methods.
7:11:09
fiddlerwoaroof
I didn't think of that, I'll have to keep that in mind if I start using this more generally
7:12:38
beach
For example, if it can be determined that no method calls CALL-NEXT-METHOD, then the NEXT-METHODS argument may be omitted.
7:13:33
beach
Another example: I can imagine some systems which would not cons up a list of arguments to pass to methods if, say, there are only required parameters.
7:17:23
pjb
fiddlerwoaroof: also, it will fail since you don't define next-method-p and call-next-method!
7:18:50
pjb
Argh, it would have, since they're lexical functions, therefore there's absolutely no home of methodcall to ever work correctly.
7:20:14
pjb
fiddlerwoaroof: it would be better to defun the body of your method and call those functions from your methods.
7:20:19
fiddlerwoaroof
The reason for the next-method related stuff is to provide something to "catch" functions that try to call-next-method
7:20:59
fiddlerwoaroof
I could also do it the way you suggest, but I wanted to experiment with this way.
7:21:07
beach
pjb: I think next-method-p and call-next-method turn into accesses on the list of next methods so it works in the default case.
7:22:13
beach
pjb: The problem is that an implementation is allowed to optimize for standard MOP-defined classes, in particular for standard-generic-function, so it could very well not work on certain implementations in that case.
7:36:07
pjb
fiddlerwoaroof: what you can test is the generic function with different classes of arguments. But it doesn't make sense to try to test single methods, in lisp, because of method combinations. In Objective-C, you could get a pointer to a method function and call it, and it would work, because it could still call super and that's all you have there as method combination.
7:37:12
pjb
This is why I don't think you can expect next-method-p and call-next-method to be statically determined (or "optimized") in general.
7:37:35
fiddlerwoaroof
But, there are a couple situations where I just want to test that my code works and I don't care what the other code being run does
7:39:05
fiddlerwoaroof
For example, if I'm using a library by extending a generic function, I might want to make sure that, given certain expected inputs, the body of the method produces the expected output, but I might not want to test the library code.
7:39:13
pjb
I don't know what you're trying to isolate. If you can implement your hack, then you can just call the generic function directly, it won't make a difference.
7:39:58
pjb
Again, if you have such simple and orthogonal methods, it may be preferable to put their bodies in separate functions, and test them.
7:40:17
fiddlerwoaroof
It might, if, for example, the :around method connects to a database and writes the result of the primary method to the database, it might be useful to run the primary method by itself to make sure the right data gets written
7:40:39
fiddlerwoaroof
And, this is mostly just an experiment, I'm not really claiming (yet) that this is actually a good idea.
7:41:14
pjb
Definitely, if you have such independent stuff, keep it in separate functions: you probably will want to reuse it elsewhere.
11:58:59
Baggers
easye: It is allowed to succeed if the object is already of the requested type though
12:04:09
edgar-rft
in some years when all folks involved in the ANSI spec are dead, we're finally allowed to implement whatever we want
13:40:16
_death
there, at the edge of the world, as chaos disperses bits throughout, lay the petrified common lisp hyperspec, ready to pronounce your implementation nonconforming
14:24:27
jackdaniel
krator44: here, this one is not proprietary: http://cvberry.com/tech_writings/notes/common_lisp_standard_draft.html
14:40:30
|3b|
also there is http://phoe.tymoon.eu/clus/doku.php which is trying to make a new/nice/etc replacement for CLHS
15:09:06
beach
krator44: We treat it that way, because the main specification seems to exist only as a scanned PDF document from ANSI.
15:11:02
beach
krator44: ANSI is a for-profit organization that owns the standard. There is no link to it.
15:11:50
krator44
well what about this one http://cvberry.com/tech_writings/notes/common_lisp_standard_draft.html
15:12:50
beach
krator44: So, again, did you buy the standard from ANSI to determine that it is not a scanned document?
15:18:54
jackdaniel
krator44: this is a fascinating read: http://www.nhplace.com/kent/Papers/cl-untold-story.html
15:30:11
fiddlerwoaroof
Section 3.2 of that essay is one of my favorite non-technical aspects of Common Lisp
15:30:44
fiddlerwoaroof
I'm pretty tired of dealing with languages and standard libraries that change out from under you.
15:32:02
jackdaniel
yes, I find it pretty amusing that CL programs from '94 work flawlessly on today implementations
16:02:14
edgar-rft
jackdaniel: it's probably more like CL programs from '94 work with *exactly the same bugs as they had then* on today implementations