From bf8bf46d1656f50b29d0beabdfad68df7288a08e Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 3 Oct 2011 15:55:53 -0700 Subject: [PATCH] Update docs for lookup-method. --- core/generic/generic-docs.factor | 12 +++++++++--- core/generic/generic.factor | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/generic/generic-docs.factor b/core/generic/generic-docs.factor index c9673a95b8..9af2805313 100644 --- a/core/generic/generic-docs.factor +++ b/core/generic/generic-docs.factor @@ -39,7 +39,7 @@ $nl "Methods can be added to existing generic words:" { $subsections create-method } "Method definitions can be looked up:" -{ $subsections method } +{ $subsections lookup-method ?lookup-method } "Finding the most specific method for an object:" { $subsections effective-method } "A generic word contains methods; the list of methods specializing on a class can also be obtained:" @@ -131,12 +131,18 @@ HELP: M\ { $class-description "Pushes a method on the stack." } { $examples { $code "M\\ fixnum + see" } { $code "USING: ui.gadgets.editors ui.render ;" "M\\ editor draw-gadget* edit" } } ; -HELP: method +HELP: lookup-method +{ $values { "class" class } { "generic" generic } { "method" method } } +{ $description "Looks up a method definition." } +{ $class-description "The class of method bodies, which are words with special word properties set." } +{ $errors "Throws an error if the method does not exist." } ; + +HELP: ?lookup-method { $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 +{ lookup-method ?lookup-method create-method POSTPONE: M: } related-words HELP: { $values { "class" class } { "generic" generic } { "method" "a new method definition" } } diff --git a/core/generic/generic.factor b/core/generic/generic.factor index c360067fa3..03fb1115de 100644 --- a/core/generic/generic.factor +++ b/core/generic/generic.factor @@ -30,7 +30,7 @@ ERROR: method-lookup-failed class generic ; : ?lookup-method ( class generic -- method/f ) "methods" word-prop at ; -: lookup-method ( class generic -- method/* ) +: lookup-method ( class generic -- method ) 2dup ?lookup-method [ 2nip ] [ method-lookup-failed ] if* ;