Merge branch 'master' into new_ui
commit
b4a61114e1
|
@ -19,15 +19,19 @@ ARTICLE: "compiler-usage" "Calling the optimizing compiler"
|
|||
"Higher-level words can be found in " { $link "compilation-units" } "." ;
|
||||
|
||||
ARTICLE: "compiler" "Optimizing compiler"
|
||||
"Factor is a fully compiled language implementation with two distinct compilers:"
|
||||
"Factor includes two compilers which work behind the scenes. Words are always compiled, and the compilers do not have to be invoked explicitly. For the most part, compilation is fully transparent. However, there are a few things worth knowing about the compilation process."
|
||||
$nl
|
||||
"The two compilers differ in the level of analysis they perform:"
|
||||
{ $list
|
||||
{ "The " { $emphasis "non-optimizing quotation compiler" } " compiles quotations to naive machine code very quickly. The non-optimizing quotation compiler is part of the VM." }
|
||||
{ "The " { $emphasis "optimizing word compiler" } " compiles whole words at a time while performing extensive data and control flow analysis. This provides greater performance for generated code, but incurs a much longer compile time. The optimizing compiler is written in Factor." }
|
||||
}
|
||||
"The optimizing compiler only compiles words which have a static stack effect. This means that methods defined on fundamental generic words such as " { $link nth } " should have a static stack effect; for otherwise, most of the system would be compiled with the non-optimizing compiler. See " { $link "inference" } " and " { $link "cookbook-pitfalls" } "."
|
||||
{ $subsection "compiler-usage" }
|
||||
"The optimizing compiler only compiles words which have a static stack effect. This means that methods defined on fundamental generic words such as " { $link nth } " should have a static stack effect. See " { $link "inference" } " and " { $link "cookbook-pitfalls" } "."
|
||||
$nl
|
||||
"The optimizing compiler also trades off compile time for performance of generated code, so loading certain vocabularies might take a while. Saving the image after loading vocabularies can save you a lot of time that you would spend waiting for the same code to load in every coding session; see " { $link "images" } " for information."
|
||||
{ $subsection "compiler-errors" }
|
||||
{ $subsection "hints" } ;
|
||||
{ $subsection "hints" }
|
||||
{ $subsection "compiler-usage" } ;
|
||||
|
||||
ABOUT: "compiler"
|
||||
|
||||
|
|
|
@ -220,24 +220,6 @@ ARTICLE: "cookbook-io" "Input and output cookbook"
|
|||
"io"
|
||||
} ;
|
||||
|
||||
ARTICLE: "cookbook-compiler" "Compiler cookbook"
|
||||
"Factor includes two compilers which work behind the scenes. Words are always compiled, and the compilers do not have to be invoked explicitly. For the most part, compilation is a fully transparent process. However, there are a few things worth knowing about the compilation process."
|
||||
$nl
|
||||
"The optimizing compiler trades off compile time for performance of generated code, so loading certain vocabularies might take a while. Saving the image after loading vocabularies can save you a lot of time that you would spend waiting for the same code to load in every coding session; see " { $link "images" } " for information."
|
||||
$nl
|
||||
"After loading a vocabulary, you might see messages like:"
|
||||
{ $code
|
||||
":errors - print 2 compiler errors."
|
||||
":warnings - print 50 compiler warnings."
|
||||
}
|
||||
"These warnings arise from the compiler's stack effect checker. Warnings are non-fatal conditions -- not all code has a static stack effect, so you try to minimize warnings but understand that in many cases they cannot be eliminated. Errors indicate programming mistakes, such as erroneous stack effect declarations."
|
||||
{ $references
|
||||
"To learn more about the compiler and static stack effect inference, read these articles:"
|
||||
"compiler"
|
||||
"compiler-errors"
|
||||
"inference"
|
||||
} ;
|
||||
|
||||
ARTICLE: "cookbook-application" "Application cookbook"
|
||||
"Vocabularies can define a main entry point:"
|
||||
{ $code "IN: game-of-life"
|
||||
|
@ -396,7 +378,6 @@ ARTICLE: "cookbook" "Factor cookbook"
|
|||
{ $subsection "cookbook-io" }
|
||||
{ $subsection "cookbook-application" }
|
||||
{ $subsection "cookbook-scripts" }
|
||||
{ $subsection "cookbook-compiler" }
|
||||
{ $subsection "cookbook-philosophy" }
|
||||
{ $subsection "cookbook-pitfalls" }
|
||||
{ $subsection "cookbook-next" } ;
|
||||
|
|
|
@ -33,8 +33,8 @@ $nl
|
|||
{ { $snippet { $emphasis "foo" } "*" } { "alternative form of " { $snippet "foo" } ", or a generic word called by " { $snippet "foo" } } { { $links at* pprint* } } }
|
||||
{ { $snippet "(" { $emphasis "foo" } ")" } { "implementation detail word used by " { $snippet "foo" } } { { $link (clone) } } }
|
||||
{ { $snippet "set-" { $emphasis "foo" } } { "sets " { $snippet "foo" } " to a new value" } { $links set-length } }
|
||||
{ { $snippet { $emphasis "foo" } ">>" } { "gets the " { $snippet "foo" } " slot of the tuple at the top of the stack; see " { $link "accessors" } } { { $link >>name } } }
|
||||
{ { $snippet ">>" { $emphasis "foo" } } { "sets the " { $snippet "foo" } " slot of the tuple at the top of the stack; see " { $link "accessors" } } { { $link name>> } } }
|
||||
{ { $snippet { $emphasis "foo" } ">>" } { "gets the " { $snippet "foo" } " slot of the tuple at the top of the stack; see " { $link "accessors" } } { { $link name>> } } }
|
||||
{ { $snippet ">>" { $emphasis "foo" } } { "sets the " { $snippet "foo" } " slot of the tuple at the top of the stack; see " { $link "accessors" } } { { $link >>name } } }
|
||||
{ { $snippet "with-" { $emphasis "foo" } } { "performs some kind of initialization and cleanup related to " { $snippet "foo" } ", usually in a new dynamic scope" } { $links with-scope with-input-stream with-output-stream } }
|
||||
{ { $snippet "$" { $emphasis "foo" } } { "help markup" } { $links $heading $emphasis } }
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ HELP: arg
|
|||
|
||||
HELP: >polar
|
||||
{ $values { "z" number } { "abs" "a non-negative real number" } { "arg" "a number in the interval " { $snippet "(-pi,pi]" } } }
|
||||
{ $description "Creates a complex number from an absolute value and argument (polar form)." } ;
|
||||
{ $description "Converts a complex number into an absolute value and argument (polar form)." } ;
|
||||
|
||||
HELP: cis
|
||||
{ $values { "arg" "a real number" } { "z" "a complex number on the unit circle" } }
|
||||
|
|
|
@ -87,6 +87,8 @@ HELP: inconsistent-recursive-call-error
|
|||
} ;
|
||||
|
||||
ARTICLE: "inference-errors" "Inference warnings and errors"
|
||||
"These conditions are thrown by " { $link "inference" } ", as well as the " { $link "compiler" } "."
|
||||
$nl
|
||||
"Main wrapper for all inference warnings and errors:"
|
||||
{ $subsection inference-error }
|
||||
"Inference warnings:"
|
||||
|
|
|
@ -22,7 +22,7 @@ ARTICLE: "slot-class-declaration" "Slot class declarations"
|
|||
ARTICLE: "slot-class-coercion" "Coercive slot declarations"
|
||||
"If the class of a slot is declared to be one of " { $link fixnum } " or " { $link float } ", then rather than testing values with the class predicate, writer words coerce values to the relevant type with " { $link >fixnum } " or " { $link >float } ". This may still result in error, but permits a wider range of values than a class predicate test. It also results in a possible loss of precision; for example, storing a large integer into a " { $link fixnum } " slot will silently overflow and discard high bits, and storing a ratio into a " { $link float } " slot may lose precision if the ratio is one which cannot be represented exactly with floating-point."
|
||||
$nl
|
||||
"This feature is mostly intended as an optimization for low-level code designed to avoid integer overflow, or where floating point precision is sufficient. Most code needs to work transparently with large integers, and thus hsould avoid the coercion behavior by using " { $link integer } " and " { $link real } " in place of " { $link fixnum } " and " { $link float } "." ;
|
||||
"This feature is mostly intended as an optimization for low-level code designed to avoid integer overflow, or where floating point precision is sufficient. Most code needs to work transparently with large integers, and thus should avoid the coercion behavior by using " { $link integer } " and " { $link real } " in place of " { $link fixnum } " and " { $link float } "." ;
|
||||
|
||||
ARTICLE: "tuple-declarations" "Tuple slot declarations"
|
||||
"The slot specifier syntax of the " { $link POSTPONE: TUPLE: } " parsing word understands the following slot attributes:"
|
||||
|
|
|
@ -3,9 +3,16 @@ USING: help.markup help.syntax vocabs.loader words io
|
|||
quotations words.symbol ;
|
||||
|
||||
ARTICLE: "compiler-errors" "Compiler warnings and errors"
|
||||
"The compiler saves " { $link "inference-errors" } " in a global variable:"
|
||||
{ $subsection compiler-errors }
|
||||
"These notifications can be viewed later:"
|
||||
"After loading a vocabulary, you might see messages like:"
|
||||
{ $code
|
||||
":errors - print 2 compiler errors."
|
||||
":warnings - print 50 compiler warnings."
|
||||
}
|
||||
"These warnings arise from the compiler's stack effect checker. Warnings are non-fatal conditions -- not all code has a static stack effect, so you try to minimize warnings but understand that in many cases they cannot be eliminated. Errors indicate programming mistakes, such as erroneous stack effect declarations."
|
||||
$nl
|
||||
"The precise warning and error conditions are documented in " { $link "inference-errors" } "."
|
||||
$nl
|
||||
"Words to view warnings and errors:"
|
||||
{ $subsection :errors }
|
||||
{ $subsection :warnings }
|
||||
{ $subsection :linkage }
|
||||
|
|
|
@ -34,13 +34,20 @@ $nl
|
|||
{ $subsection "vocabs.roots" }
|
||||
"Vocabulary names map directly to source files. A vocabulary named " { $snippet "foo.bar" } " must be defined in a " { $snippet "bar" } " directory nested inside a " { $snippet "foo" } " directory of a vocabulary root. Any level of vocabulary nesting is permitted."
|
||||
$nl
|
||||
"The vocabulary directory - " { $snippet "bar" } " in our example - can contain the following files; the first is required while the rest are optional:"
|
||||
"The vocabulary directory - " { $snippet "bar" } " in our example - contains a source file:"
|
||||
{ $list
|
||||
{ { $snippet "foo/bar/bar.factor" } " - the source file, must define words in the " { $snippet "foo.bar" } " vocabulary with an " { $snippet "IN: foo.bar" } " form" }
|
||||
}
|
||||
"Two other Factor source files, storing documentation and tests, respectively, are optional:"
|
||||
{ $list
|
||||
{ { $snippet "foo/bar/bar.factor" } " - the source file, defines words in the " { $snippet "foo.bar" } " vocabulary" }
|
||||
{ { $snippet "foo/bar/bar-docs.factor" } " - documentation, see " { $link "writing-help" } }
|
||||
{ { $snippet "foo/bar/bar-tests.factor" } " - unit tests, see " { $link "tools.test" } }
|
||||
}
|
||||
"Finally, three text files can contain meta-data:"
|
||||
{ $list
|
||||
{ { $snippet "foo/bar/authors.txt" } " - a series of lines, with one author name per line. These are listed under " { $link "vocab-authors" } }
|
||||
{ { $snippet "foo/bar/summary.txt" } " - a one-line description" }
|
||||
{ { $snippet "foo/bar/tags.txt" } " - a whitespace-separated list of tags which classify the vocabulary" }
|
||||
{ { $snippet "foo/bar/tags.txt" } " - a whitespace-separated list of tags which classify the vocabulary. Consult " { $link "vocab-tags" } " for a list of existing tags you can re-use" }
|
||||
}
|
||||
"While " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } " load vocabularies which have not been loaded before adding them to the search path, it is also possible to load a vocabulary without adding it to the search path:"
|
||||
{ $subsection require }
|
||||
|
|
Loading…
Reference in New Issue