Christophe Weblog Wiki Code Publications Music
specializable.git
10 years agogitignore fasls
Christophe Rhodes [Sun, 5 Jan 2014 21:03:56 +0000 (21:03 +0000)]
gitignore fasls

10 years agodeal with keyword argument checking
Christophe Rhodes [Sun, 5 Jan 2014 20:41:01 +0000 (20:41 +0000)]
deal with keyword argument checking

it was actually mostly done internally to PCL, in the effective method
computation.  However, for probably tedious historical reasons, the
way that this is actually implemented involves binding a magical
special variable at the point that the effective method form is turned
into code, which we weren't doing.  Now we are.

Include a test case.

10 years agodelete stale add/remove-direct-method comment
Christophe Rhodes [Sat, 21 Dec 2013 14:52:50 +0000 (14:52 +0000)]
delete stale add/remove-direct-method comment

10 years agoget SPECIALIZER-DIRECT-METHODS (and -GENERIC-FUNCTIONS) right
Christophe Rhodes [Fri, 20 Dec 2013 18:55:02 +0000 (18:55 +0000)]
get SPECIALIZER-DIRECT-METHODS (and -GENERIC-FUNCTIONS) right

we can do what we need by having SB-MOP:ADD-DIRECT-METHODS and
SB-MOP:REMOVE-DIRECT-METHODS maintain a per-class table, indexed by
the specializers under SB-PCL::SAME-SPECIALIZER-P, of direct methods.
This then is agnostic to whether the specializers are interned or
freshly generated.

10 years agoadapt content-negotiation method combination
Christophe Rhodes [Tue, 17 Dec 2013 12:24:25 +0000 (12:24 +0000)]
adapt content-negotiation method combination

Make CALL-NEXT-METHOD cause an irrevocable control transfer: returning
from any primary method returns from all of them.  (Because
media-types are basically disjoint, it doesn't really make sense to
have CALL-NEXT-METHOD return).

10 years agoallow digits in the media subtype
Christophe Rhodes [Tue, 17 Dec 2013 12:17:27 +0000 (12:17 +0000)]
allow digits in the media subtype

audio/mp3 might be helpful

10 years agofinish implementing ACCEPT specializers
Christophe Rhodes [Mon, 16 Dec 2013 16:31:55 +0000 (16:31 +0000)]
finish implementing ACCEPT specializers

A handy example to do dispatch based on the Accept: header in
HTTP requests.  Includes a tricky method combination which
in addition can set the Content-Type: header of the response.

10 years agonew protocol function GENERALIZER-EQUAL-HASH-KEY
Christophe Rhodes [Mon, 16 Dec 2013 16:30:05 +0000 (16:30 +0000)]
new protocol function GENERALIZER-EQUAL-HASH-KEY

We need arbitrary generalizer objects, not least so as to have
composable specializer functions (if we want generic functions
which can have more than one extended specializer class, we need
to be sure that our generalizers won't stomp on each other).

But that means that cacheing effective methods depends totally on
interning generalizers, which is a bit lame, unless we ask the
extended specializer implementor to provide a subkey to be used
in the key to the emf cache.  This new protocol function is a hook
for exactly that purpose.

(Minimally update the cons specializer example: it's still bad, in
that it uses symbols as the generalizer for conses, but the protocol
in principle at least doesn't leak now.)

10 years agoaccept-header parsing
Christophe Rhodes [Mon, 16 Dec 2013 09:05:12 +0000 (09:05 +0000)]
accept-header parsing

INSERT routine to insert (and possibly modify the q of) a node

Parser using cl-ppcre, which will win few prizes for robustness but at
least gets the header as sent by Chromium on my computer right...

10 years agoimprove print-object for accept-tree-node
Christophe Rhodes [Mon, 16 Dec 2013 09:03:39 +0000 (09:03 +0000)]
improve print-object for accept-tree-node

only display the (unparsed) accept string if we are printing
the root node

10 years agobeginnings of content-type negotiation specializer
Christophe Rhodes [Sat, 14 Dec 2013 08:54:40 +0000 (08:54 +0000)]
beginnings of content-type negotiation specializer

method combination and media-type priority computation.  Still needs
work on the accept header parser

10 years agoget the protocol more right
Christophe Rhodes [Fri, 13 Dec 2013 00:01:56 +0000 (00:01 +0000)]
get the protocol more right

Include some generic function arguments for specialization in protocol
functions involving generalizers.  (Otherwise there are some cases where
it's not possible to define methods not in violation of the rules about
specializers applicable to instances of not-standard classes.)

Adjust the CONS-SPECIALIZER example to suit, and include an extra test
case which shows of method-combination as well as the new ability to
have multiple applicable methods with class specializers.

10 years agofix one package export
Christophe Rhodes [Thu, 12 Dec 2013 23:59:40 +0000 (23:59 +0000)]
fix one package export

one update -CLASS -> -GENERALIZER

10 years agotest case!
Christophe Rhodes [Thu, 12 Dec 2013 14:54:28 +0000 (14:54 +0000)]
test case!

Include some assertions on the behaviour of WALK

10 years agoflush the EMF cache in REINITIALIZE-INSTANCE of SPECIALIZABLE-GENERIC-FUNCTION
Christophe Rhodes [Thu, 12 Dec 2013 14:54:06 +0000 (14:54 +0000)]
flush the EMF cache in REINITIALIZE-INSTANCE of SPECIALIZABLE-GENERIC-FUNCTION

10 years agonote a fixme
Christophe Rhodes [Thu, 12 Dec 2013 14:53:33 +0000 (14:53 +0000)]
note a fixme

10 years agohandle arbitrary method combination
Christophe Rhodes [Wed, 11 Dec 2013 20:53:48 +0000 (20:53 +0000)]
handle arbitrary method combination

I think it's practically impossible to do on our own, certainly
efficiently: handling the pseudo-lisp that is an effective method is
likely to go wrong.  Piggy-back on SBCL, with
SB-PCL::MAKE-EFFECTIVE-METHOD-FUNCTION and SB-PCL::INVOKE-EMF

10 years agopackage fixup for cons specializers
Christophe Rhodes [Wed, 11 Dec 2013 20:49:56 +0000 (20:49 +0000)]
package fixup for cons specializers

also note a problem with the current protocol

10 years agoseparate out cons-specializer and walk into their own file
Christophe Rhodes [Wed, 11 Dec 2013 10:21:56 +0000 (10:21 +0000)]
separate out cons-specializer and walk into their own file

10 years agoinitial commit
Christophe Rhodes [Tue, 10 Dec 2013 21:38:25 +0000 (21:38 +0000)]
initial commit

Somewhat modified version of specializable.lisp from
http://www.lichteblau.com/git/?p=specializable.git
[ commit eb30d235951c3c1d128811278760f1db36cd336c ]

Lightly modified on a first read-through, mostly cosmetic though with
the innovation of the GENERALIZER concept, as in
COMPUTE-APPLICABLE-METHODS-USING-GENERALIZER and
SPECIALIZER-ACCEPTS-GENERALIZER-P.  Lots of FIXME notes for the things
that weren't trivial.