! Copyright (c) 2008 Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license.
-USING: words kernel sequences locals locals.parser fry
-locals.definitions accessors parser namespaces continuations
-summary definitions generalizations arrays prettyprint debugger io
-effects tools.annotations ;
+USING: accessors arrays continuations debugger definitions
+effects effects.parser generalizations io kernel
+locals.definitions locals.parser prettyprint sequences
+sequences.generalizations tools.annotations words ;
IN: descriptive
ERROR: descriptive-error args underlying word ;
: make-descriptive ( word -- )
dup [ ] [ def>> ] [ stack-effect ] tri [descriptive]
- '[ drop _ ] annotate-methods ;
+ '[ drop _ ] annotate ;
: define-descriptive ( word def effect -- )
[ drop "descriptive-definition" set-word-prop ]
SYNTAX: DESCRIPTIVE: (:) define-descriptive ;
PREDICATE: descriptive < word
- "descriptive-definition" word-prop ;
+ "descriptive-definition" word-prop >boolean ;
M: descriptive definer drop \ DESCRIPTIVE: \ ; ;
M: descriptive definition
"descriptive-definition" word-prop ;
+M: descriptive reset-word
+ [ call-next-method ]
+ [ "descriptive-definition" remove-word-prop ] bi ;
+
SYNTAX: DESCRIPTIVE:: (::) define-descriptive ;
-INTERSECTION: descriptive-lambda descriptive lambda-word ;
+PREDICATE: descriptive-lambda < descriptive lambda-word? ;
M: descriptive-lambda definer drop \ DESCRIPTIVE:: \ ; ;
M: descriptive-lambda definition
"lambda" word-prop body>> ;
+
+M: descriptive-lambda reset-word
+ [ call-next-method ] [ "lambda" remove-word-prop ] bi ;