freenode/#sicl - IRC Chatlog
Search
9:39:02
beach
heisig: How do you estimate the cost of testing the keyword parameters of a sequence function, compared to the generic dispatch for the class of the sequence?
9:39:25
beach
I remember you had some idea about the keyword parameters, but I don't remember what it was.
9:40:03
beach
It seems to me a good idea to have compiler macros for that kind of stuff, but I realize that a compiler macro is hard to write for those cases. But perhaps it could be automated.
9:41:58
heisig
My sealable-metaobjects library can already determine whether a particular call site leads to a fixed list of applicable methods.
9:42:40
heisig
Given these methods, and the fact that all involved specializers, methods and the generic functions are sealed, we can do some tricks.
9:43:42
beach
OK, so presumably the compiler could then simplify the tests involving the keyword parameters. Is that the idea?
9:43:56
heisig
Yes, the trick is to inline only the keyword parsing step, and to automatically generate a second effective method with mandatory arguments only.
9:45:04
heisig
The important part is that everything is automated. No way for us humans to screw up more than once :)
9:46:35
heisig
Of course there are limitations. If the sequence argument of FIND has no known type, there will just be a regular call to a generic function.
9:47:31
heisig
But that is the price to pay for the ability to add new methods with new keywords at any time.
9:57:00
beach
So the idea could be to enclose the methods in a big FLET with one function for each combination of keyword arguments so that the effective method does only the argument parsing.
10:06:45
heisig
(lambda (#:arg0 &key (#:arg1 nil #:arg2)) (funcall (load-time-value (lookup-fast-effective-method ...)) #:arg0 #:arg1 #:arg2))