Christophe Weblog Wiki Code Publications Music
specializable.git
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.