]> gitweb.factorcode.org Git - factor.git/blob - extra/descriptive/descriptive-docs.factor
Factor source files should not be executable
[factor.git] / extra / descriptive / descriptive-docs.factor
1 USING: help.syntax help.markup words ;\r
2 IN: descriptive\r
3 \r
4 HELP: DESCRIPTIVE:\r
5 { $syntax "DESCRIPTIVE: word ( inputs -- outputs ) definition ;" }\r
6 { $description "Defines a word such that, if an error is thrown from within it, that error is wrapped in a " { $link descriptive-error } " with the arguments to that word." } ;\r
7 \r
8 HELP: DESCRIPTIVE::\r
9 { $syntax "DESCRIPTIVE:: word ( inputs -- outputs ) definition ;" }\r
10 { $description "Defines a word which uses locals such that, if an error is thrown from within it, that error is wrapped in a " { $link descriptive-error } " with the arguments to that word." } ;\r
11 \r
12 HELP: descriptive-error\r
13 { $error-description "The class of errors wrapping another error (in the underlying slot) which were thrown in a word (in the word slot) with a given set of arguments (in the args slot)." } ;\r
14 \r
15 HELP: make-descriptive\r
16 { $values { "word" word } }\r
17 { $description "Makes the word wrap errors in " { $link descriptive-error } " instances." } ;\r
18 \r
19 ARTICLE: "descriptive" "Descriptive errors"\r
20 "This vocabulary defines automatic descriptive errors. Using it, you can define a word which acts as normal, except when it throws an error, the error is wrapped in an instance of a class:"\r
21 { $subsections descriptive-error }\r
22 "The wrapper contains the word itself, the input parameters, as well as the original error."\r
23 $nl\r
24 "To annotate an existing word with descriptive error checking:"\r
25 { $subsections make-descriptive }\r
26 "To define words which throw descriptive errors, use the following words:"\r
27 { $subsections\r
28     POSTPONE: DESCRIPTIVE:\r
29     POSTPONE: DESCRIPTIVE::\r
30 } ;\r
31 \r
32 ABOUT: "descriptive"\r