diff options
| author | Patrick Walton <[email protected]> | 2011-04-06 10:25:32 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-04-06 10:25:32 -0700 |
| commit | d9da43984b5e9d50f711320d2afc3307537dfb44 (patch) | |
| tree | 6b9b3eefc8909c7621c01b7e039375deb019e7b1 /doc | |
| parent | rustc: Make type_of() return the type of the wrapper for native functions. li... (diff) | |
| parent | Minimal testcase for next bootstrap blocker. (diff) | |
| download | rust-d9da43984b5e9d50f711320d2afc3307537dfb44.tar.xz rust-d9da43984b5e9d50f711320d2afc3307537dfb44.zip | |
Merge branch 'master' of github.com:graydon/rust
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/rust.texi | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/doc/rust.texi b/doc/rust.texi index 1dd6b6bf..36e973d6 100644 --- a/doc/rust.texi +++ b/doc/rust.texi @@ -120,7 +120,7 @@ table. The task ahead involves combining, trimming, and implementing. @end quotation @sp 2 -Rust is a curly-brace, block-structured statement language. It visually +Rust is a curly-brace, block-structured expression language. It visually resembles the C language family, but differs significantly in syntactic and semantic details. Its design is oriented toward concerns of ``programming in the large'', that is, of creating and maintaining @emph{boundaries} -- both @@ -334,7 +334,7 @@ The Rust type system is primarily structural, and contains the standard assortment of useful ``algebraic'' type constructors from functional languages, such as function types, tuples, record types, vectors, and nominally-tagged disjoint unions. Such values may be @emph{pattern-matched} in -an @code{alt} statement. +an @code{alt} expression. @sp 1 @item Generic code @@ -394,8 +394,8 @@ the surrounding text by skipping over the bracketed ``extension text''. @sp 1 @item Idempotent failure -If a task fails due to a signal, or if it executes the special @code{fail} -statement, it enters the @emph{failing} state. A failing task unwinds its +If a task fails due to a signal, or if it evaluates the special @code{fail} +expression, it enters the @emph{failing} state. A failing task unwinds its control stack, frees all of its owned resources (executing destructors) and enters the @emph{dead} state. Failure is idempotent and non-recoverable. @@ -1486,8 +1486,8 @@ operating-system processes. @cindex Port @cindex Channel @cindex Message passing -@cindex Send statement -@cindex Receive statement +@cindex Send expression +@cindex Receive expression With the exception of @emph{unsafe} constructs, Rust tasks are isolated from interfering with one another's memory directly. Instead of manipulating shared @@ -1563,14 +1563,14 @@ A task begins its lifecycle -- once it has been spawned -- in the function, and any functions called by the entry function. A task may transition from the @emph{running} state to the @emph{blocked} -state any time it executes a communication statement on a port or channel that -cannot be immediately completed. When the communication statement can be +state any time it evaluates a communication expression on a port or channel that +cannot be immediately completed. When the communication expression can be completed -- when a message arrives at a sender, or a queue drains sufficiently to complete a semi-synchronous send -- then the blocked task will unblock and transition back to @emph{running}. A task may transition to the @emph{failing} state at any time, due to an -un-trapped signal or the execution of a @code{fail} statement. Once +un-trapped signal or the evaluation of a @code{fail} expression. Once @emph{failing}, a task unwinds its stack and transitions to the @emph{dead} state. Unwinding the stack of a task is done by the task itself, on its own control stack. If a value with a destructor is freed during unwinding, the @@ -1804,8 +1804,8 @@ otherwise exactly as a function item (with a minor additional cost of calling the function, as such a call is indirect). @xref{Ref.Type.Fn}. Every control path in a function ends with either a @code{ret} or @code{be} -statement. If a control path lacks a @code{ret} statement in source code, an -implicit @code{ret} statement is appended to the end of the control path +expression. If a control path lacks a @code{ret} expression in source code, an +implicit @code{ret} expression is appended to the end of the control path during compilation, returning the implicit @code{()} value. A function may have an @emph{effect}, which may be either @code{impure} or @@ -1827,9 +1827,9 @@ fn add(int x, int y) -> int @{ @c * Ref.Item.Iter:: Items defining iterators. @cindex Iterators -@cindex Put statement -@cindex Put each statement -@cindex Foreach statement +@cindex Put expression +@cindex Put each expression +@cindex Foreach expression Iterators are function-like items that can @code{put} multiple values during their execution before returning or tail-calling. @@ -1841,11 +1841,11 @@ but the iterator frame is only @emph{suspended} during the put, and will be the caller's loop. The output type of an iterator is the type of value that the function will -@code{put}, before it eventually executes a @code{ret} or @code{be} statement +@code{put}, before it eventually evaluates a @code{ret} or @code{be} expression of type @code{()} and completes its execution. An iterator can only be called in the loop header of a matching @code{for -each} loop or as the argument in a @code{put each} statement. +each} loop or as the argument in a @code{put each} expression. @xref{Ref.Stmt.Foreach}. An example of an iterator: @@ -2052,13 +2052,13 @@ Rust; they cannot be used as user-defined identifiers in any context. @cindex Any type @cindex Dynamic type, see @i{Any type} @cindex Reflection -@cindex Alt type statement +@cindex Alt type expression The type @code{any} is the union of all possible Rust types. A value of type @code{any} is represented in memory as a pair consisting of a boxed value of some non-@code{any} type @var{T} and a reflection of the type @var{T}. -Values of type @code{any} can be used in an @code{alt type} statement, in +Values of type @code{any} can be used in an @code{alt type} expression, in which the reflection is used to select a block corresponding to a particular type extraction. @xref{Ref.Stmt.Alt}. @@ -2549,7 +2549,7 @@ right hand side of copy statements, @xref{Ref.Stmt.Copy}. @c * Ref.Stmt:: Executable statements. @cindex Statements -A @dfn{statement} is a component of a block, which is in turn a components of +A @dfn{statement} is a component of a block, which is in turn a component of an outer block, a function or an iterator. When a function is spawned into a task, the task @emph{executes} statements in an order determined by the body of the enclosing structure. Each statement causes the task to perform certain |