factor/core/modules.facts

52 lines
3.0 KiB
Plaintext

IN: modules
USING: help io parser ;
HELP: module-def
{ $values { "name" "a module name string" } { "path" "a path name string" } }
{ $description "Outputs the location of the module definition file. This word looks for the module definition in two locations relative to the " { $link resource-path } ":"
{ $list
{ $snippet { $emphasis "name" } ".factor" }
{ $snippet { $emphasis "name" } "/load.factor" }
}
}
{ $notes "This file is loaded by " { $link require } ", and should contain the necessary " { $link POSTPONE: REQUIRES: } " and " { $link POSTPONE: PROVIDE: } " declarations for the module." } ;
HELP: modules
{ $var-description "Sequence of " { $link module } " instances." } ;
{ modules require load-module } related-words
HELP: load-module
{ $values { "name" "a module name string" } }
{ $description "Runs the module definition file given by " { $link module-def } ", which loads the module's dependencies and source files." }
{ $notes "Calling this word directly is rarely necessary. Usually, " { $link require } " is used to load modules and " { $link reload-modules } " is used to reload changed files." } ;
HELP: require
{ $values { "name" "a module name string" } }
{ $description "Ensures that a module has been loaded, along with all its dependencies, and compiles all new words."
$nl
"If this module is already listed in the " { $link modules } " hashtable, this word does nothing. Otherwise, it calls " { $link load-module } "." }
{ $notes "This word is only for interactive use in the listener, and user-interface code."
$nl
"In a source file or module definition, modules should instead be loaded with the " { $link POSTPONE: REQUIRES: } " parsing word. This is because the parser parses an entire file before evaluating top-level forms." } ;
HELP: provide
{ $values { "name" "a string" } { "hash" "a hashtable" } { "loc" "a pair holding a path name and line number" } }
{ $description "Registers a module definition and loads its source files. The possible hashtable keys are documented in the " { $link POSTPONE: PROVIDE: } " word. Usually instead of calling this word, module definitions use the parsing word " { $link POSTPONE: PROVIDE: } " instead." } ;
HELP: reload-module
{ $values { "name" "a module name string" } }
{ $description "Reloads any source files making up a module if they have been modified on disk since last being loaded. Most of the time " { $link reload-modules } " should be called instead." } ;
HELP: reload-modules
{ $values { "seq" "a sequence of module name strings" } }
{ $description "Reloads all source files in all specified modules which have been modified on disk since last being loaded." } ;
{ reload-modules reload-core reload-libs reset-checksums } related-words
HELP: reload-core
{ $description "Reloads all source files from core modules which have been modified on disk since last being loaded." } ;
HELP: reload-libs
{ $description "Reloads all source files from non-core modules which have been modified on disk since last being loaded." } ;