]> gitweb.factorcode.org Git - factor.git/blob - core/generic/hook/hook.factor
Make M\ throw an error upon lookup failure. Change method -> ?lookup-method, lookup...
[factor.git] / core / generic / hook / hook.factor
1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors definitions generic generic.single
4 generic.single.private kernel namespaces words kernel.private
5 quotations sequences ;
6 QUALIFIED-WITH: generic.single.private gsp
7 IN: generic.hook
8
9 TUPLE: hook-combination < single-combination var ;
10
11 C: <hook-combination> hook-combination
12
13 PREDICATE: hook-generic < generic
14     "combination" word-prop hook-combination? ;
15
16 M: hook-combination picker
17     combination get var>> [ get ] curry ;
18
19 M: hook-combination dispatch# drop 0 ;
20
21 M: hook-combination mega-cache-quot
22     1quotation picker [ gsp:lookup-method (execute) ] surround ;
23
24 M: hook-generic definer drop \ HOOK: f ;
25
26 M: hook-generic effective-method
27     [ "combination" word-prop var>> get ] keep method-for-object ;