1 USING: words kernel sequences locals locals.parser
2 locals.definitions accessors parser namespaces continuations
3 summary definitions generalizations arrays prettyprint debugger io ;
6 ERROR: descriptive-error args underlying word ;
8 M: descriptive-error error.
9 "The word " write dup word>> pprint " encountered an error." print
17 : rethrower ( word inputs -- quot )
18 [ length ] keep [ [ narray ] dip swap 2array flip ] 2curry
19 [ 2 ndip descriptive-error ] 2curry ;
21 : [descriptive] ( word def effect -- newdef )
22 swapd in>> rethrower [ recover ] 2curry ;
26 : define-descriptive ( word def effect -- )
27 [ drop "descriptive-definition" set-word-prop ]
28 [ [ [ dup ] 2dip [descriptive] ] keep define-declared ]
31 SYNTAX: DESCRIPTIVE: (:) define-descriptive ;
33 PREDICATE: descriptive < word
34 "descriptive-definition" word-prop ;
36 M: descriptive definer drop \ DESCRIPTIVE: \ ; ;
38 M: descriptive definition
39 "descriptive-definition" word-prop ;
41 SYNTAX: DESCRIPTIVE:: (::) define-descriptive ;
43 INTERSECTION: descriptive-lambda descriptive lambda-word ;
45 M: descriptive-lambda definer drop \ DESCRIPTIVE:: \ ; ;
47 M: descriptive-lambda definition
48 "lambda" word-prop body>> ;