Christophe Weblog Wiki Code Publications Music
specializable.git
6 years agoadd files from Jan Moringen's pattern-specializer repository master
Christophe Rhodes [Sun, 13 Apr 2014 19:57:27 +0000 (20:57 +0100)]
add files from Jan Moringen's pattern-specializer repository

6 years agorearrange repository to have src/ and examples/ directories
Christophe Rhodes [Sun, 13 Apr 2014 19:55:15 +0000 (20:55 +0100)]
rearrange repository to have src/ and examples/ directories

6 years agocontent-negotiation is better described using OR method-combination
Christophe Rhodes [Sun, 13 Apr 2014 19:50:21 +0000 (20:50 +0100)]
content-negotiation is better described using OR method-combination

6 years agouse CALL-NEXT-METHOD rather than CLASS-OF for NEXT slot filling els2014-submission
Christophe Rhodes [Wed, 5 Mar 2014 11:00:20 +0000 (11:00 +0000)]
use CALL-NEXT-METHOD rather than CLASS-OF for NEXT slot filling

6 years agosimplify parsing a bit
Christophe Rhodes [Sun, 2 Mar 2014 20:19:59 +0000 (20:19 +0000)]
simplify parsing a bit

(patch from Jan Moringen but it didn't apply any more)

6 years agonote that TRACE / PROFILE are now handled by SBCL itself
Christophe Rhodes [Sun, 2 Mar 2014 20:14:58 +0000 (20:14 +0000)]
note that TRACE / PROFILE are now handled by SBCL itself

6 years agounused stuff
Jan Moringen [Tue, 18 Feb 2014 03:12:47 +0000 (04:12 +0100)]
unused stuff

6 years agoadded system definition file
Jan Moringen [Sun, 23 Feb 2014 19:28:29 +0000 (20:28 +0100)]
added system definition file

possibly stretching the asdf syntax a bit, but this system definitely
has at least two authors

6 years agominor things in accept-specializer.lisp
Jan Moringen [Tue, 18 Feb 2014 03:15:00 +0000 (04:15 +0100)]
minor things in accept-specializer.lisp

6 years agoprototype of prototype specializers
Christophe Rhodes [Sun, 2 Mar 2014 17:03:55 +0000 (17:03 +0000)]
prototype of prototype specializers

Need to write some more tests, but I think the main thing that isn't
"right" is dealing with redefinitions

6 years agofix treatment of zero q values
Christophe Rhodes [Sun, 2 Mar 2014 16:58:22 +0000 (16:58 +0000)]
fix treatment of zero q values

a q value of 0 means "not acceptable", not "less acceptable than 0.1
but still acceptable".

6 years agoprettify walker slightly
Christophe Rhodes [Sun, 2 Mar 2014 16:57:33 +0000 (16:57 +0000)]
prettify walker slightly

6 years agodistinct walker which actually does something
Christophe Rhodes [Sat, 22 Feb 2014 20:52:43 +0000 (20:52 +0000)]
distinct walker which actually does something

for benchmarking purposes

6 years agoseparate out (internal) functions
Christophe Rhodes [Sat, 22 Feb 2014 20:52:23 +0000 (20:52 +0000)]
separate out (internal) functions

slow-method-lookup now just looks up the emf;
slow-method-lookup-and-call is responsible for invoking it (and maybe
cacheing it too).

In the process, allow generic functions to control the extent of
cacheing; this feature is only useful for research paper authors

6 years agofirst-arg-only dispatch special case
Christophe Rhodes [Mon, 17 Feb 2014 20:34:49 +0000 (20:34 +0000)]
first-arg-only dispatch special case

For speed

6 years agocall NO-APPLICABLE-METHOD in the appropriate place
Christophe Rhodes [Fri, 7 Feb 2014 10:05:21 +0000 (10:05 +0000)]
call NO-APPLICABLE-METHOD in the appropriate place

Otherwise we end up with NO-PRIMARY-METHODs.  We should only compute
an EMF if there are in fact some methods, or at least that seems to be
the current behaviour of SB-MOP:COMPUTE-EFFECTIVE-METHOD-FUNCTION

6 years agoadd signum specializer example
Christophe Rhodes [Thu, 6 Feb 2014 14:15:46 +0000 (14:15 +0000)]
add signum specializer example

6 years agonote problem with :class slot
Christophe Rhodes [Thu, 16 Jan 2014 12:44:35 +0000 (12:44 +0000)]
note problem with :class slot

Really I want per-class allocation, not "in this class" allocation.
Achievable with a small amount of MOP, but...

6 years agogitignore fasls
Christophe Rhodes [Sun, 5 Jan 2014 21:03:56 +0000 (21:03 +0000)]
gitignore fasls

6 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.

6 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

6 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.

6 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).

6 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

6 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.

6 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.)

6 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...

6 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

6 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

6 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.

6 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

6 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

6 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

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

6 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

6 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

6 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

6 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.