Pragmatic directives: Difference between revisions

Add Factor
m (→‎{{header|Mathematica }}: fix header markup)
(Add Factor)
Line 157:
 
More module attributes at [http://www.erlang.org/doc/reference_manual/modules.html].
 
=={{header|Factor}}==
Factor provides the following compiler declarations which can be used immediately following a word definition:
 
* '''inline'''
:: Declares the most recently defined word as an inline word. The optimizing compiler copies definitions of inline words when compiling calls to them. Combinators must be inlined in order to compile with the optimizing compiler. For any other word, inlining is merely an optimization.
 
* '''foldable'''
:: Declares that the most recently defined word may be evaluated at compile-time if all inputs are literal. Foldable words must satisfy a very strong contract:
 
::* foldable words must not have any observable side effects
::* foldable words must halt — for example, a word computing a series until it coverges should not be foldable, since compilation will not halt in the event the series does not converge
::* both inputs and outputs of foldable words must be immutable
 
:: Most operations on numbers are foldable. For example, <code>2 2 +</code> compiles to a literal <code>4</code>, since <code>+</code> is declared foldable.
 
* '''flushable'''
:: Declares that the most recently defined word has no side effects, and thus calls to this word may be pruned by the compiler if the outputs are not used.
 
:: Note that many words are flushable but not foldable, for example <code>clone</code> and <code><array></code>.
 
* '''recursive'''
:: Declares the most recently defined word as a recursive word. This declaration is only required for inline words which call themselves.
 
* '''deprecated'''
:: Declares the most recently defined word as deprecated. Code that uses deprecated words continues to function normally; the errors are purely informational. However, code that uses deprecated words should be updated, for the deprecated words are intended to be removed soon.
 
Additionally, parsing words sometimes alter compiler behavior. For example, the compiler uses type information from <code>TYPED:</code> words for optimizations.
 
=={{header|Go}}==
1,808

edits