From: Slava Pestov Date: Wed, 17 Feb 2010 12:19:39 +0000 (+1300) Subject: Minor documentation fixes X-Git-Tag: 0.97~4909^2~1^2~14 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=63928191e719c041624300c37e9e855c550a2b46 Minor documentation fixes --- diff --git a/basis/listener/listener-docs.factor b/basis/listener/listener-docs.factor index 77bec12c1a..a35f43e848 100644 --- a/basis/listener/listener-docs.factor +++ b/basis/listener/listener-docs.factor @@ -1,8 +1,8 @@ -USING: help.markup help.syntax kernel io system prettyprint continuations quotations ; +USING: help.markup help.syntax kernel io system prettyprint continuations quotations vocabs.loader vocabs.refresh parser ; IN: listener ARTICLE: "listener-watch" "Watching variables in the listener" -"The listener prints the concepts of the data and retain stacks after every expression. It can also print values of dynamic variables which are added to a watch list:" +"The listener prints values of dynamic variables which are added to a watch list:" { $subsections visible-vars } "To add or remove a single variable:" { $subsections @@ -14,7 +14,7 @@ ARTICLE: "listener-watch" "Watching variables in the listener" show-vars hide-vars } -"Hiding all visible variables:" +"Clearing the watch list:" { $subsections hide-all-vars } ; HELP: only-use-vocabs @@ -46,21 +46,33 @@ HELP: hide-all-vars { $description "Removes all variables from the watch list." } ; ARTICLE: "listener" "The listener" -"The listener evaluates Factor expressions read from a stream. The listener is the primary interface to the Factor runtime. Typically, you write Factor code in a text editor, then load it using the listener and test it." +"The listener evaluates Factor expressions read from the input stream. Typically, you write Factor code in a text editor, load it from the listener by calling " { $link require } ", " { $link refresh-all } " or " { $link run-file } ", and then test it from interactively." $nl "The classical first program can be run in the listener:" { $example "\"Hello, world\" print" "Hello, world" } +"New words can also be defined in the listener:" +{ $example + "USE: math.functions" + ": twice ( word -- ) [ execute ] [ execute ] bi ; inline" + "81 \\ sqrt twice ." + "3" +} "Multi-line expressions are supported:" { $example "{ 1 2 3 } [\n .\n] each" "1\n2\n3" } -"The listener knows when to expect more input by looking at the height of the stack. Parsing words such as " { $link POSTPONE: { } " leave elements on the parser stack, and corresponding words such as " { $link POSTPONE: } } " pop them." +"The listener will display the current contents of the datastack after every line of input." $nl -"The listener will display the current contents of the datastack after every expression is evaluated. The listener can additionally watch dynamic variables:" +"The listener can watch dynamic variables:" { $subsections "listener-watch" } -"To start a nested listener:" +"Nested listeners can be useful for testing code in other dynamic scopes. For example, when doing database maintanance using the " { $vocab-link "db.tuples" } " vocabulary, it can be useful to start a listener with a database connection:" +{ $code + "USING: db db.sqlite listener ;" + "\"data.db\" [ listener ] with-db" +} +"Starting a nested listener:" { $subsections listener } "To exit a listener, invoke the " { $link return } " word." $nl -"Multi-line quotations can be read independently of the rest of the listener:" +"The listener's mechanism for reading multi-line expressions from the input stream can be called from user code:" { $subsections read-quot } ; ABOUT: "listener" diff --git a/core/generic/generic-docs.factor b/core/generic/generic-docs.factor index 3a9314fb56..8d4f1f61a5 100644 --- a/core/generic/generic-docs.factor +++ b/core/generic/generic-docs.factor @@ -166,7 +166,13 @@ HELP: create-method HELP: (call-next-method) { $values { "method" method } } { $description "Low-level word implementing " { $link POSTPONE: call-next-method } "." } -{ $notes "In most cases, " { $link POSTPONE: call-next-method } " should be used instead." } ; +{ $notes + "The " { $link POSTPONE: call-next-method } " word parses into this word. The following are equivalent:" + { $code + "M: class generic call-next-method ;" + "M: class generic M\\ class generic (call-next-method) ;" + } +} ; HELP: no-next-method { $error-description "Thrown by " { $link POSTPONE: call-next-method } " if the current method is already the least specific method." }