1 USING: words kernel sequences locals locals.parser
\r
2 locals.definitions accessors parser namespaces continuations
\r
3 summary definitions generalizations arrays ;
\r
6 ERROR: descriptive-error args underlying word ;
\r
8 M: descriptive-error summary
\r
9 word>> "The " swap name>> " word encountered an error."
\r
13 : rethrower ( word inputs -- quot )
\r
14 [ length ] keep [ [ narray ] dip swap 2array flip ] 2curry
\r
15 [ 2 ndip descriptive-error ] 2curry ;
\r
17 : [descriptive] ( word def -- newdef )
\r
18 swap dup "declared-effect" word-prop in>> rethrower
\r
19 [ recover ] 2curry ;
\r
22 : define-descriptive ( word def -- )
\r
23 [ "descriptive-definition" set-word-prop ]
\r
24 [ dupd [descriptive] define ] 2bi ;
\r
27 (:) define-descriptive ; parsing
\r
29 PREDICATE: descriptive < word
\r
30 "descriptive-definition" word-prop ;
\r
32 M: descriptive definer drop \ DESCRIPTIVE: \ ; ;
\r
34 M: descriptive definition
\r
35 "descriptive-definition" word-prop ;
\r
38 (::) define-descriptive ; parsing
\r
40 INTERSECTION: descriptive-lambda descriptive lambda-word ;
\r
42 M: descriptive-lambda definer drop \ DESCRIPTIVE:: \ ; ;
\r
44 M: descriptive-lambda definition
\r
45 "lambda" word-prop body>> ;
\r