freenode/#lisp - IRC Chatlog
Search
14:43:58
kenanb
beach: oh I just read the relevant section. I can see the benefits (actually, I can read them) but it feels like that indirection makes certain optimizations rather impossible. Am I correct? Things like compile time method dispatch when type is known in advance ( I don't even know if that is possible with existing implementations either )
14:44:58
kenanb
beach: of course, I am not saying it is a bad idea, I am just trying to understand the implications of the decision.
14:45:13
beach
kenanb: You mean doing the optimization at the call site? That's tricky stuff anyway.
14:46:09
beach
It is tricky because methods can be added and removed after the caller has been compiled.
14:47:53
kenanb
hmm, you are correct, the method to dispatch over will indeed change as new methods are added to the generic function
14:49:18
phoe
you need to recompile a lot of code on each GF redefinition, and I don't know any implementations that do this
14:54:39
Bike
but beach's gf dispatch technique basically makes generic functions a JIT mechanism where dispatch is very fast, and doesn't involve putting methods together or anything. since the problem of method combination is made mostly static all a call cache gets you is a slightly shorter dispatch, which is probably not a huge win
14:57:48
drmeister
You can scroll around and zoom but not search (sigh). Maybe there is a better chrome PDF viewer.
14:58:14
Bike
i think one thing that would be interesting to do would be compiling accessors within method bodies as not having caches at all- since the dispatch caching could be extended to recompile things when necessary
14:59:30
makomo
beach: where should i look for this gf dispatch method that you described? i'm interested
15:01:45
kenanb
Bike: yeah, I don't know, it would probably only be significant in tight loops. It would probably be cool to be able to claim something like "inside this function, foo-method calls will always dispatch over the exact same function and I promise I will not redefine it before the end of the loop"
15:03:27
kenanb
letting compiler temporarily treat a certain method as a regular function via a claim, so it can grab a raw pointer to the function and work with it during the loop
15:05:20
kenanb
Bike: my reply was a reply to your earlier statement, I think the last one also makes sense tho
15:12:34
kenanb
of course, that optimization can usually be achieved by programmers being more specific about their intent, like refactoring that particular method body into a regular function and calling it directly when necessary, so its not a huge problem.
15:24:24
Bike
yeah i mean if the programmer is guaranteeing the method won't be redefined etc they're basically not using anything about clos
15:34:01
kenanb
well, they might still be dynamically dispatching over a gf, the claim was the dispatch is the same for calls in all iteration of that particular loop
15:35:51
kenanb
every time you hit that loop the dispatch would be done only once, but the arrays you are iterating over would hold different objects
15:46:20
Bike
it would be pretty easy for me to hook something up that fetched the effective method function for a given list of specializers. then you'd just call it. the rest is syntactic sugar
15:53:38
Bike
you could have like (with-fixed-gf (foo integer string (eql 'fazbar)) ...) expand into (let ((#:foo (effective-method-function #'foo (list (find-class 'integer) (find-class 'string) (intern-eql-specializer 'fazbar))))) (flet ((foo (&rest args) (apply #:foo args))) ...)) for a start
16:02:16
specbot
Naming of Compiler Macros: http://www.lispworks.com/reference/HyperSpec/Body/03_bbab.htm
16:02:32
phoe
Compiler macro definitions are strictly global. There is no provision for defining local compiler macros in the way that macrolet defines local macros.
16:05:21
makomo
how do you guys pronounce "macrolet"? ever since i read that about it in cltl2, i can't stop pronouncing it in a way that rhymes with chevrolet :-)
16:19:57
kenanb
Bike: yeah, that looks like a pretty elegant way to express such a thing. btw your ELS talk is very interesting.
16:23:31
alandipert
anyone have suggestions about how i could speed this up? it's currently about 2x slower than c. thanks in advance! https://github.com/alandipert/puzzles/blob/master/blackjack/sbcl/outcomes_optimized.lisp
16:28:53
alandipert
my guess is function call overhead (of PARTITIONS) is maybe the next slowest thing? but i don't know how to measure that. and i can't easily inline partitions because it's recursive
16:29:20
alandipert
so i was thinking maybe a next step would be a tail recursive version of partitions
17:01:52
kenanb
if you are really worried about performance, maybe you should stick to loops. making it tail-recursive will make the stack happy, but it will not decrease your call overhead.
17:01:54
slyrus2
Is there a way to "trace" ASDF such that one can actually see what the calls to the compiler are?
17:04:06
pfdietz
You could trace COMPILE-FILE, or maybe there's some generic function you could write an around method for.
17:04:34
slyrus2
pfdietz: yeah, I tried that but I don't seem to get any output. I must be doing something wrong.
17:05:18
kenanb
AFAIK asdf already provided an interface to access generated list of all tasks for a certain load-op.
17:10:26
kenanb
slyrus2: asdf:traverse is the function. as I said, that is only for getting the generated task list
17:21:43
slyrus2
aha! the with-muffled-compiler-conditions form in uiop.lisp was stealing my trace output.
17:39:22
Bike
compile-file is a standard function, so tracing it is undefined behavior and might do weird dumb thing.s
17:40:08
slyrus2
Hmm.. interesting. In this case it works fine once I unmuffle the conditions down inside UIOP:compile-file*
18:16:13
random9899
the interactive failure thing was annoying, throwing you into the debugger and stuff....
21:26:11
Inline
the test-creating-multiple-tests testsuite in lift gives me once 4 or 3 or 2 as an answer to a 3 tests grouped by 2 case
21:46:45
Inline
compiling the lift-test system gives consistent results tho, so something is in the vulnerable ephemeral state somewhere
21:47:13
Inline
cause testing it right after i load all of my packages and my repl tends to give wrong answers
23:45:01
asarch
2) How could you specify which 'get-sugar' (either from 'chocolate' or from 'cafe') you want in 'serving-drink'?
23:45:44
asarch
From the question #1 I get: 3: (ERROR "Illegal function call in method body:~% ~S" ((FORMAT T "The level of sugar is: ~d~%" (GET-SUGAR CUP))))
23:46:38
on_ion
although i would say, the slot 'sugar' would be part of something that the chocolate and the cafe would share
23:47:11
Bike
you have serving-drink with a defgeneric with one parameters, and then the method has two parameters.
23:49:38
Bike
which, per precedence rules, would be the one for CHOCOLATE since it's the leftmost superclass
23:50:16
Bike
you should just specify the sugar slot in a parent class, and then specify initforms in the lower class if you'd like
23:54:26
asarch
In my example, because of the class precedence list 'serving-drink' uses 'sugar' from 'chocolate'
23:55:10
Bike
As I said, you probably don't want to do that. You can't have two distinct slots with the same name in the same object.
23:58:07
Bike
As I said, if you must you can think of everything about classes as being what C++ terms "virtual".
23:59:09
specbot
Inheritance of Slots and Slot Options: http://www.lispworks.com/reference/HyperSpec/Body/07_ec.htm
23:59:51
asarch
So, if I do: (defparameter *my-cup* (make-instance 'dinner)) and then (serving-drink *my-cup*), 'sugar' from 'cafe' doesn't exist, right?
0:00:35
Bike
The defclass merges the slot definition information from the 'cafe' and 'chocolate' classes.
0:01:54
asarch
In (defclass dinner (chocolate cafe) ()), I thought the 'sugar' slot was from the last element from the class precedence list
0:03:16
Bike
The two slot definitions only differ in their initform and docstring. According to the page I just linked, dinner's slot will have these from the most specific superclass, i.e. CHOCOLATE.
0:07:51
Bike
you might even be able to arrange a metaclass where child classes just get the unaltered class from their supers
0:08:10
Bike
and then you access them with some special slot-value where you include a class designator in addition to the slot name
0:13:17
asarch
Reading about CLOS and all related stuff, I found the CLOS version of Racket is Swindle
0:14:59
msmith
hi all, can someone remind me of the command that would allow me to destructure a list and use it as parameters in a function?
0:17:49
asarch
So far I found three "glitches" in Lisp: 1) You can't read the value of "ARGS" in a binary file (for passing values) 2) There is no standard way to access to the value of :documentation from defclass 3) And this :-P
0:21:45
asarch
Well, you write an small application in Lisp to start a web server and then you need to specify the port number manually: my-lisp-server --port 8080
0:23:12
Bike
it's nothing i do very often, but there are some libraries, like http://quickdocs.org/command-line-arguments/
0:29:45
White_Flame
of course, each implementation also exposes a simple list of strings representing C's argv