drop [ <method> dup ] 2keep reveal-method
] if ;
+PREDICATE: default-method < word "default" word-prop ;
+
+M: default-method irrelevant? drop t ;
+
: <default-method> ( generic combination -- method )
[ drop object bootstrap-word swap <method> ] [ make-default-method ] 2bi
[ define ] [ drop t "default" set-word-prop ] [ drop ] 2tri ;
M: method-body forget*
dup "forgotten" word-prop [ drop ] [
[
- dup "default" word-prop [ drop ] [
+ dup default-method? [ drop ] [
[
[ "method-class" word-prop ]
[ "method-generic" word-prop ] bi
: error-method ( word -- quot )
picker swap [ no-method ] curry append ;
-: default-method ( word -- pair )
- "default-method" word-prop
- object bootstrap-word swap 2array ;
-
: push-method ( method specializer atomic assoc -- )
[
[ H{ } clone <predicate-dispatch-engine> ] unless*