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? ;
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? ;
! 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
: breakage-word ( a b -- c ) + ;
-MACRO: breakage-macro ( a -- ) '[ _ breakage-word ] ;
+<< MACRO: breakage-macro ( a -- ) '[ _ breakage-word ] ; >>
GENERIC: breakage-caller ( a -- c )
: 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 ;
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
[ 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 ;
[ [ (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>) , ;
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! ;
specializer [ specialize-quot ] when* ;
: standard-method? ( method -- ? )
- dup method-body? [
+ dup method? [
"method-generic" word-prop standard-generic?
] [ drop f ] if ;
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:: \ ; ;
M: word pprint*
[ pprint-word ] [ ?start-group ] [ ?end-group ] tri ;
-M: method-body pprint*
+M: method pprint*
[
[
[ "M\\ " % "method-class" word-prop word-name* % ]
M: wrapper pprint*
{
- { [ dup wrapped>> method-body? ] [ wrapped>> pprint* ] }
+ { [ dup wrapped>> method? ] [ wrapped>> pprint* ] }
{ [ dup wrapped>> word? ] [ <block \ \ pprint-word wrapped>> pprint-word block> ] }
[ pprint-object ]
} cond ;
first3
[
{
- { [ dup method-body? ] [ "Method: " write . ] }
+ { [ dup method? ] [ "Method: " write . ] }
{ [ dup word? ] [ "Word: " write . ] }
[ drop ]
} cond
[ stack-effect. ]
} cleave ;
-M: method-body synopsis*
+M: method synopsis*
[ definer. ]
[ "method-class" word-prop pprint-word ]
[ "method-generic" word-prop pprint-word ] tri ;
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 ;
[ [ 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
: 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 -- )
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 <image-name> ] [ synopsis ] bi ]
{ $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
$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." } ;
[ ] [ "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
[ dup "combination" word-prop perform-combination ]
bi ;
+PREDICATE: method < word
+ "method-generic" word-prop >boolean ;
+
: method ( class generic -- method/f )
"methods" word-prop at ;
: 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 )
dupd <default-method> "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 ] [
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 )
slot-spec new
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