From df55fed478f33743511be4b5fc505e0e0d852329 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 1 Feb 2010 20:08:24 +1300 Subject: [PATCH] generic: rename method-body predicate class to method --- basis/compiler/compiler.factor | 4 ++-- basis/compiler/tests/redefine0.factor | 4 ++-- basis/compiler/tests/redefine13.factor | 2 +- basis/compiler/tests/stack-trace.factor | 2 +- basis/compiler/tree/debugger/debugger.factor | 2 +- basis/delegate/delegate.factor | 2 +- basis/functors/functors.factor | 4 ++-- basis/hints/hints.factor | 2 +- basis/locals/definitions/definitions.factor | 2 +- basis/prettyprint/backend/backend.factor | 4 ++-- basis/prettyprint/prettyprint.factor | 2 +- basis/see/see.factor | 2 +- basis/tools/crossref/crossref.factor | 4 ++-- .../tools/listener/completion/completion.factor | 2 +- basis/ui/tools/profiler/profiler.factor | 2 +- core/generic/generic-docs.factor | 12 +++++------- core/generic/generic-tests.factor | 2 +- core/generic/generic.factor | 16 ++++++++-------- core/slots/slots.factor | 4 ++-- extra/mason/test/test.factor | 2 +- 20 files changed, 37 insertions(+), 39 deletions(-) diff --git a/basis/compiler/compiler.factor b/basis/compiler/compiler.factor index 5be2b0de87..f83eab7fb0 100644 --- a/basis/compiler/compiler.factor +++ b/basis/compiler/compiler.factor @@ -54,7 +54,7 @@ SYMBOL: compiled GENERIC: no-compile? ( word -- ? ) -M: method-body no-compile? "method-generic" word-prop no-compile? ; +M: method no-compile? "method-generic" word-prop no-compile? ; M: predicate-engine-word no-compile? "owner-generic" word-prop no-compile? ; @@ -63,7 +63,7 @@ M: word no-compile? GENERIC: combinator? ( word -- ? ) -M: method-body combinator? "method-generic" word-prop combinator? ; +M: method combinator? "method-generic" word-prop combinator? ; M: predicate-engine-word combinator? "owner-generic" word-prop combinator? ; diff --git a/basis/compiler/tests/redefine0.factor b/basis/compiler/tests/redefine0.factor index 4de6d952c8..ff928fee28 100644 --- a/basis/compiler/tests/redefine0.factor +++ b/basis/compiler/tests/redefine0.factor @@ -77,8 +77,8 @@ M: integer test-7 + ; ! Indirect dependency on an unoptimized word : test-9 ( -- ) ; << SYMBOL: quot -[ test-9 ] quot set-global >> -MACRO: test-10 ( -- quot ) quot get ; +[ test-9 ] quot set-global +MACRO: test-10 ( -- quot ) quot get ; >> : test-11 ( -- ) test-10 ; [ ] [ test-11 ] unit-test diff --git a/basis/compiler/tests/redefine13.factor b/basis/compiler/tests/redefine13.factor index d092cd4ee1..1befdd5b5d 100644 --- a/basis/compiler/tests/redefine13.factor +++ b/basis/compiler/tests/redefine13.factor @@ -3,7 +3,7 @@ IN: compiler.tests.redefine13 : breakage-word ( a b -- c ) + ; -MACRO: breakage-macro ( a -- ) '[ _ breakage-word ] ; +<< MACRO: breakage-macro ( a -- ) '[ _ breakage-word ] ; >> GENERIC: breakage-caller ( a -- c ) diff --git a/basis/compiler/tests/stack-trace.factor b/basis/compiler/tests/stack-trace.factor index 40aa1bb336..3d31245168 100644 --- a/basis/compiler/tests/stack-trace.factor +++ b/basis/compiler/tests/stack-trace.factor @@ -5,7 +5,7 @@ IN: compiler.tests.stack-trace : symbolic-stack-trace ( -- newseq ) error-continuation get call>> callstack>array - 2 group flip first ; + 3 group flip first ; : foo ( -- * ) 3 throw 7 ; : bar ( -- * ) foo 4 ; diff --git a/basis/compiler/tree/debugger/debugger.factor b/basis/compiler/tree/debugger/debugger.factor index fd2962bb16..c9b60922bd 100644 --- a/basis/compiler/tree/debugger/debugger.factor +++ b/basis/compiler/tree/debugger/debugger.factor @@ -159,7 +159,7 @@ SYMBOL: node-count word>> { { [ dup "intrinsic" word-prop ] [ intrinsics-called ] } { [ dup generic? ] [ generics-called ] } - { [ dup method-body? ] [ methods-called ] } + { [ dup method? ] [ methods-called ] } [ words-called ] } cond get inc-at ] [ drop ] if diff --git a/basis/delegate/delegate.factor b/basis/delegate/delegate.factor index fe6ea03794..d033b7115b 100644 --- a/basis/delegate/delegate.factor +++ b/basis/delegate/delegate.factor @@ -39,7 +39,7 @@ TUPLE: consultation group class quot loc ; [ class>> swap first create-method dup fake-definition ] keep [ drop ] [ "consultation" set-word-prop ] 2bi ; -PREDICATE: consult-method < method-body "consultation" word-prop ; +PREDICATE: consult-method < method "consultation" word-prop ; M: consult-method reset-word [ call-next-method ] [ f "consultation" set-word-prop ] bi ; diff --git a/basis/functors/functors.factor b/basis/functors/functors.factor index a03463e911..ac2e52f68e 100644 --- a/basis/functors/functors.factor +++ b/basis/functors/functors.factor @@ -37,7 +37,7 @@ M: array (fake-quotations>) [ [ (fake-quotations>) ] each ] { } make , ; M: fake-call-next-method (fake-quotations>) - drop method-body get literalize , \ (call-next-method) , ; + drop \ method get literalize , \ (call-next-method) , ; M: object (fake-quotations>) , ; @@ -74,7 +74,7 @@ FUNCTOR-SYNTAX: MIXIN: FUNCTOR-SYNTAX: M: scan-param suffix! scan-param suffix! - [ create-method-in dup method-body set ] append! + [ create-method-in dup \ method set ] append! parse-definition* \ define* suffix! ; diff --git a/basis/hints/hints.factor b/basis/hints/hints.factor index 7a3fa323d2..62d97b478c 100644 --- a/basis/hints/hints.factor +++ b/basis/hints/hints.factor @@ -52,7 +52,7 @@ M: object specializer-declaration class ; specializer [ specialize-quot ] when* ; : standard-method? ( method -- ? ) - dup method-body? [ + dup method? [ "method-generic" word-prop standard-generic? ] [ drop f ] if ; diff --git a/basis/locals/definitions/definitions.factor b/basis/locals/definitions/definitions.factor index a4299d0684..6fc715ba8d 100644 --- a/basis/locals/definitions/definitions.factor +++ b/basis/locals/definitions/definitions.factor @@ -24,7 +24,7 @@ M: lambda-macro definition M: lambda-macro reset-word [ call-next-method ] [ f "lambda" set-word-prop ] bi ; -INTERSECTION: lambda-method method-body lambda-word ; +INTERSECTION: lambda-method method lambda-word ; M: lambda-method definer drop \ M:: \ ; ; diff --git a/basis/prettyprint/backend/backend.factor b/basis/prettyprint/backend/backend.factor index 04617a6c67..11d97a5118 100644 --- a/basis/prettyprint/backend/backend.factor +++ b/basis/prettyprint/backend/backend.factor @@ -37,7 +37,7 @@ M: parsing-word pprint* M: word pprint* [ pprint-word ] [ ?start-group ] [ ?end-group ] tri ; -M: method-body pprint* +M: method pprint* [ [ [ "M\\ " % "method-class" word-prop word-name* % ] @@ -229,7 +229,7 @@ M: compose pprint* pprint-object ; M: wrapper pprint* { - { [ dup wrapped>> method-body? ] [ wrapped>> pprint* ] } + { [ dup wrapped>> method? ] [ wrapped>> pprint* ] } { [ dup wrapped>> word? ] [ > pprint-word block> ] } [ pprint-object ] } cond ; diff --git a/basis/prettyprint/prettyprint.factor b/basis/prettyprint/prettyprint.factor index ccc77068e6..7582f3248d 100644 --- a/basis/prettyprint/prettyprint.factor +++ b/basis/prettyprint/prettyprint.factor @@ -78,7 +78,7 @@ SYMBOL: -> first3 [ { - { [ dup method-body? ] [ "Method: " write . ] } + { [ dup method? ] [ "Method: " write . ] } { [ dup word? ] [ "Word: " write . ] } [ drop ] } cond diff --git a/basis/see/see.factor b/basis/see/see.factor index 51d3971c38..0d2388114a 100644 --- a/basis/see/see.factor +++ b/basis/see/see.factor @@ -76,7 +76,7 @@ M: hook-generic synopsis* [ stack-effect. ] } cleave ; -M: method-body synopsis* +M: method synopsis* [ definer. ] [ "method-class" word-prop pprint-word ] [ "method-generic" word-prop pprint-word ] tri ; diff --git a/basis/tools/crossref/crossref.factor b/basis/tools/crossref/crossref.factor index daa30100a4..3bdf2f83ae 100644 --- a/basis/tools/crossref/crossref.factor +++ b/basis/tools/crossref/crossref.factor @@ -103,7 +103,7 @@ GENERIC: smart-usage ( defspec -- seq ) M: object smart-usage usage [ irrelevant? not ] filter ; -M: method-body smart-usage "method-generic" word-prop smart-usage ; +M: method smart-usage "method-generic" word-prop smart-usage ; M: f smart-usage drop \ f smart-usage ; @@ -124,7 +124,7 @@ M: f smart-usage drop \ f smart-usage ; [ [ vocab-name ] [ words [ generic? not ] filter ] bi ] dip map [ [ [ word? ] [ generic? not ] bi and ] filter [ - dup method-body? + dup method? [ "method-generic" word-prop ] when vocabulary>> ] map diff --git a/basis/ui/tools/listener/completion/completion.factor b/basis/ui/tools/listener/completion/completion.factor index b069de1887..391cce7a9e 100644 --- a/basis/ui/tools/listener/completion/completion.factor +++ b/basis/ui/tools/listener/completion/completion.factor @@ -119,7 +119,7 @@ M: object completion-string present ; : method-completion-string ( word -- string ) "method-generic" word-prop present ; -M: method-body completion-string method-completion-string ; +M: method completion-string method-completion-string ; GENERIC# accept-completion-hook 1 ( item popup -- ) diff --git a/basis/ui/tools/profiler/profiler.factor b/basis/ui/tools/profiler/profiler.factor index 3de7c9cc70..462ea201e6 100644 --- a/basis/ui/tools/profiler/profiler.factor +++ b/basis/ui/tools/profiler/profiler.factor @@ -60,7 +60,7 @@ SINGLETON: method-renderer M: method-renderer column-alignment drop { 0 0 1 } ; M: method-renderer filled-column drop 1 ; -! Value is a { method-body count } pair +! Value is a { method count } pair M: method-renderer row-columns drop [ [ [ definition-icon ] [ synopsis ] bi ] diff --git a/core/generic/generic-docs.factor b/core/generic/generic-docs.factor index 4b78f22f04..3a9314fb56 100644 --- a/core/generic/generic-docs.factor +++ b/core/generic/generic-docs.factor @@ -131,12 +131,10 @@ HELP: M\ { $class-description "Pushes a method on the stack." } { $examples { $code "M\\ fixnum + see" } { $code "USING: ui.gadgets ui.gadgets.editors ;" "M\\ editor draw-gadget* edit" } } ; -HELP: method-body -{ $class-description "The class of method bodies, which are words with special word properties set." } ; - HELP: method -{ $values { "class" class } { "generic" generic } { "method/f" { $maybe method-body } } } -{ $description "Looks up a method definition." } ; +{ $values { "class" class } { "generic" generic } { "method/f" { $maybe method } } } +{ $description "Looks up a method definition." } +{ $class-description "The class of method bodies, which are words with special word properties set." } ; { method create-method POSTPONE: M: } related-words @@ -159,14 +157,14 @@ HELP: with-methods $low-level-note ; HELP: create-method -{ $values { "class" class } { "generic" generic } { "method" method-body } } +{ $values { "class" class } { "generic" generic } { "method" method } } { $description "Creates a method or returns an existing one. This is the runtime equivalent of " { $link POSTPONE: M: } "." } { $notes "To define a method, pass the output value to " { $link define } "." } ; { sort-classes order } related-words HELP: (call-next-method) -{ $values { "method" method-body } } +{ $values { "method" method } } { $description "Low-level word implementing " { $link POSTPONE: call-next-method } "." } { $notes "In most cases, " { $link POSTPONE: call-next-method } " should be used instead." } ; diff --git a/core/generic/generic-tests.factor b/core/generic/generic-tests.factor index ff38ee39ea..700448805c 100644 --- a/core/generic/generic-tests.factor +++ b/core/generic/generic-tests.factor @@ -207,7 +207,7 @@ M: integer forget-test 3 + ; [ ] [ "IN: generic.tests USE: math FORGET: M\\ integer forget-test" eval( -- ) ] unit-test [ { } ] [ - \ + effect-dependencies-of keys [ method-body? ] filter + \ + effect-dependencies-of keys [ method? ] filter [ "method-generic" word-prop \ forget-test eq? ] filter ] unit-test diff --git a/core/generic/generic.factor b/core/generic/generic.factor index 62ff40acfc..9fd7a5be85 100644 --- a/core/generic/generic.factor +++ b/core/generic/generic.factor @@ -21,6 +21,9 @@ M: generic definition drop f ; [ dup "combination" word-prop perform-combination ] bi ; +PREDICATE: method < word + "method-generic" word-prop >boolean ; + : method ( class generic -- method/f ) "methods" word-prop at ; @@ -101,16 +104,13 @@ GENERIC: update-generic ( class generic -- ) : method-word-name ( class generic -- string ) [ name>> ] bi@ "=>" glue ; -PREDICATE: method-body < word - "method-generic" word-prop >boolean ; - -M: method-body flushable? +M: method flushable? "method-generic" word-prop flushable? ; -M: method-body stack-effect +M: method stack-effect "method-generic" word-prop stack-effect ; -M: method-body crossref? +M: method crossref? "forgotten" word-prop not ; : method-word-props ( class generic -- assoc ) @@ -150,10 +150,10 @@ PREDICATE: default-method < word "default" word-prop ; dupd "default-method" set-word-prop ; ! Definition protocol -M: method-body definer +M: method definer drop \ M: \ ; ; -M: method-body forget* +M: method forget* dup "forgotten" word-prop [ drop ] [ [ dup default-method? [ drop ] [ diff --git a/core/slots/slots.factor b/core/slots/slots.factor index 7b97748249..f6bd13cf6d 100644 --- a/core/slots/slots.factor +++ b/core/slots/slots.factor @@ -10,11 +10,11 @@ TUPLE: slot-spec name offset class initial read-only ; PREDICATE: reader < word "reader" word-prop ; -PREDICATE: reader-method < method-body "reading" word-prop ; +PREDICATE: reader-method < method "reading" word-prop ; PREDICATE: writer < word "writer" word-prop ; -PREDICATE: writer-method < method-body "writing" word-prop ; +PREDICATE: writer-method < method "writing" word-prop ; : ( -- slot-spec ) slot-spec new diff --git a/extra/mason/test/test.factor b/extra/mason/test/test.factor index 034d86b9c6..bd703d3cb9 100644 --- a/extra/mason/test/test.factor +++ b/extra/mason/test/test.factor @@ -18,7 +18,7 @@ GENERIC: word-vocabulary ( word -- vocabulary ) M: word word-vocabulary vocabulary>> ; -M: method-body word-vocabulary "method-generic" word-prop word-vocabulary ; +M: method word-vocabulary "method-generic" word-prop word-vocabulary ; :: do-step ( errors summary-file details-file -- ) errors -- 2.34.1