Mercurial Hosting > luan
diff website/src/manual.html.luan @ 464:eddf7c73373b
fix references in the manual
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 07 May 2015 21:31:19 -0600 |
parents | e3a6d9dbd694 |
children | 47c7de1f2322 |
line wrap: on
line diff
--- a/website/src/manual.html.luan Wed May 06 21:44:56 2015 -0600 +++ b/website/src/manual.html.luan Thu May 07 21:31:19 2015 -0600 @@ -77,7 +77,7 @@ <li><a href="#fn_def">Function Definitions</a></li> </ul> </li> - <li><a href="#visibility">>Visibility Rules</a></li> + <li><a href="#visibility">Visibility Rules</a></li> </ul> </div> @@ -135,7 +135,7 @@ <p> Luan can call (and manipulate) functions written in Luan and -functions written in Java (see <a href="#3.4.10">§3.4.10</a>). +functions written in Java (see <a href="#fn_calls">Function Calls</a>). Both are represented by the type <i>function</i>. @@ -168,14 +168,14 @@ The language supports this representation by providing <tt>a.name</tt> as syntactic sugar for <tt>a["name"]</tt>. There are several convenient ways to create tables in Luan -(see <a href="#3.4.9">§3.4.9</a>). +(see <a href="#constructors">Table Constructors</a>). <p> We use the term <i>sequence</i> to denote a table where the set of all positive numeric keys is equal to {1..<i>n</i>} for some non-negative integer <i>n</i>, -which is called the length of the sequence (see <a href="#3.4.7">§3.4.7</a>). +which is called the length of the sequence (see <a href="#length">The Length Operator</a>). <p> @@ -184,7 +184,7 @@ In particular, because functions are first-class values, table fields can contain functions. -Thus tables can also carry <i>methods</i> (see <a href="#3.4.11">§3.4.11</a>). +Thus tables can also carry <i>methods</i> (see <a href="#fn_def">Function Definitions</a>). <p> @@ -219,12 +219,12 @@ <h3 margin-top="1em"><a name="env">Environments</a></h3> <p> -As will be discussed in <a href="#3.2">§3.2</a> and <a href="#3.3.3">§3.3.3</a>, +As will be discussed in <a href="#vars">Variables</a> and <a href=#assignment">Assignment</a>, any reference to a free name (that is, a name not bound to any declaration) <tt>var</tt> is syntactically translated to <tt>_ENV.var</tt>. Moreover, every chunk is compiled in the scope of -an external local variable named <tt>_ENV</tt> (see <a href="#3.3.2">§3.3.2</a>), +an external local variable named <tt>_ENV</tt> (see <a href="#chunks">Chunks</a>), so <tt>_ENV</tt> itself is never a free name in a chunk. @@ -236,7 +236,7 @@ you can define new variables and parameters with that name. Each reference to a free name uses the <tt>_ENV</tt> that is visible at that point in the program, -following the usual visibility rules of Luan (see <a href="#3.5">§3.5</a>). +following the usual visibility rules of Luan (see <a href="#visibility">Visibility Rules</a>). <p> @@ -403,7 +403,7 @@ (always adjusted to one value) is the result of the operation. If there is no metamethod but the object is a table, -then Luan uses the table length operation (see <a href="#3.4.7">§3.4.7</a>). +then Luan uses the table length operation (see <a href="#length">The Length Operator</a>). Otherwise, Luan raises an error. </li> @@ -726,15 +726,15 @@ </pre></tt></p> <p> -Name denotes identifiers, as defined in <a href="#3.1">§3.1</a>. +Name denotes identifiers, as defined in <a href="#lex">Lexical Conventions</a>. <p> Any variable name is assumed to be global unless explicitly declared -as a local (see <a href="#3.3.7">§3.3.7</a>). +as a local (see <a href="#local_stmt">Local Declarations</a>). Local variables are <i>lexically scoped</i>: local variables can be freely accessed by functions -defined inside their scope (see <a href="#3.5">§3.5</a>). +defined inside their scope (see <a href="#visibility">Visibility Rules</a>). <p> @@ -752,7 +752,7 @@ The meaning of accesses to table fields can be changed via metatables. An access to an indexed variable <tt>t[i]</tt> is equivalent to a call <tt>gettable_event(t,i)</tt>. -(See <a href="#2.4">§2.4</a> for a complete description of the +(See <a href="#meta">Metatables and Metamethods</a> for a complete description of the <tt>gettable_event</tt> function. This function is not defined or callable in Luan. We use it here only for explanatory purposes.) @@ -770,7 +770,7 @@ An access to a global variable <tt>x</tt> is equivalent to <tt>_ENV.x</tt>. Due to the way that chunks are compiled, -<tt>_ENV</tt> is never a global name (see <a href="#2.2">§2.2</a>). +<tt>_ENV</tt> is never a global name (see <a href="#env">Environments</a>). @@ -819,7 +819,7 @@ to control the scope of variable declarations. Explicit blocks are also sometimes used to add a <b>return</b> statement in the middle -of another block (see <a href="#3.3.4">§3.3.4</a>). +of another block (see <a href="#control">Control Structures</a>). @@ -839,7 +839,7 @@ <p> Luan handles a chunk as the body of an anonymous function with a variable number of arguments -(see <a href="#3.4.11">§3.4.11</a>). +(see <a href="#fn_def">Function Definitions</a>). As such, chunks can define local variables, receive arguments, and return values. @@ -871,7 +871,7 @@ </pre></tt></p> <p> -Expressions are discussed in <a href="#3.4">§3.4</a>. +Expressions are discussed in <a href="#expressions">Expressions</a>. <p> @@ -885,7 +885,7 @@ If the list of expressions ends with a function call, then all values returned by that call enter the list of values, before the adjustment -(except when the call is enclosed in parentheses; see <a href="#3.4">§3.4</a>). +(except when the call is enclosed in parentheses; see <a href="#expressions">Expressions</a>). <p> @@ -925,7 +925,7 @@ and table fields can be changed via metatables. An assignment to an indexed variable <tt>t[i] = val</tt> is equivalent to <tt>settable_event(t,i,val)</tt>. -(See <a href="#2.4">§2.4</a> for a complete description of the +(See <a href="#meta">Metatables and Metamethods</a> for a complete description of the <tt>settable_event</tt> function. This function is not defined or callable in Luan. We use it here only for explanatory purposes.) @@ -934,7 +934,7 @@ <p> An assignment to a global name <tt>x = val</tt> is equivalent to the assignment -<tt>_ENV.x = val</tt> (see <a href="#2.2">§2.2</a>). +<tt>_ENV.x = val</tt> (see <a href="#env">Environments</a>). @@ -953,7 +953,7 @@ </pre></tt></p> <p> -Luan also has a <b>for</b> statement (see <a href="#3.3.5">§3.3.5</a>). +Luan also has a <b>for</b> statement (see <a href="#for">For Statement</a>). <p> @@ -1078,7 +1078,7 @@ <p> In this case, all returned values are thrown away. -Function calls are explained in <a href="#3.4.10">§3.4.10</a>. +Function calls are explained in <a href="#fn_calls">Function Calls</a>. @@ -1094,17 +1094,17 @@ <p> If present, an initial assignment has the same semantics -of a multiple assignment (see <a href="#3.3.3">§3.3.3</a>). +of a multiple assignment (see <a href="#assignment">Assignment</a>). Otherwise, all variables are initialized with <b>nil</b>. <p> -A chunk is also a block (see <a href="#3.3.2">§3.3.2</a>), +A chunk is also a block (see <a href="#chunks">Chunks</a>), and so local variables can be declared in a chunk outside any explicit block. <p> -The visibility rules for local variables are explained in <a href="#3.5">§3.5</a>. +The visibility rules for local variables are explained in <a href="#visibility">Visibility Rules</a>. @@ -1128,29 +1128,29 @@ </pre></tt></p> <p> -Numerals and literal strings are explained in <a href="#3.1">§3.1</a>; -variables are explained in <a href="#3.2">§3.2</a>; -function definitions are explained in <a href="#3.4.11">§3.4.11</a>; -function calls are explained in <a href="#3.4.10">§3.4.10</a>; -table constructors are explained in <a href="#3.4.9">§3.4.9</a>. +Numerals and literal strings are explained in <a href="#lex">Lexical Conventions</a>; +variables are explained in <a href="#vars">Variables</a>; +function definitions are explained in <a href="#fn_def">Function Definitions</a>; +function calls are explained in <a href="#fn_calls">Function Calls</a>; +table constructors are explained in <a href="#constructors">Table Constructors</a>. Vararg expressions, denoted by three dots ('<tt>...</tt>'), can only be used when directly inside a vararg function; -they are explained in <a href="#3.4.11">§3.4.11</a>. - - -<p> -Binary operators comprise arithmetic operators (see <a href="#3.4.1">§3.4.1</a>), -relational operators (see <a href="#3.4.4">§3.4.4</a>), logical operators (see <a href="#3.4.5">§3.4.5</a>), -and the concatenation operator (see <a href="#3.4.6">§3.4.6</a>). -Unary operators comprise the unary minus (see <a href="#3.4.1">§3.4.1</a>), -the unary logical <b>not</b> (see <a href="#3.4.5">§3.4.5</a>), -and the unary <em>length operator</em> (see <a href="#3.4.7">§3.4.7</a>). +they are explained in <a href="#fn_def">Function Definitions</a>. + + +<p> +Binary operators comprise arithmetic operators (see <a href="#arithmetic">Arithmetic Operators</a>), +relational operators (see <a href="#relational">Relational Operators</a>), logical operators (see <a href="#logical_ops">Logical Operators</a>), +and the concatenation operator (see <a href="#concatenation">Concatenation</a>). +Unary operators comprise the unary minus (see <a href="#arithmetic">Arithmetic Operators</a>), +the unary logical <b>not</b> (see <a href="#logical_ops">Logical Operators</a>), +and the unary <em>length operator</em> (see <a href="#length">The Length Operator</a>). <p> Both function calls and vararg expressions can result in multiple values. -If a function call is used as a statement (see <a href="#3.3.6">§3.3.6</a>), +If a function call is used as a statement (see <a href="#fn_stmt">Function Calls as Statements</a>), then its return list is adjusted to zero elements, thus discarding all returned values. If an expression is used as the last (or the only) element @@ -1266,7 +1266,7 @@ <p> You can change the way that Luan compares tables -by using the "eq" metamethod (see <a href="#2.4">§2.4</a>). +by using the "eq" metamethod (see <a href="#meta">Metatables and Metamethods</a>). <p> Userdata are Java objects. They are compared for equality with the Java <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals(java.lang.Object)"><tt>equals</tt></a> method. @@ -1292,7 +1292,7 @@ Otherwise, if both arguments are strings, then their values are compared according to the current locale. Otherwise, Luan tries to call the "lt" or the "le" -metamethod (see <a href="#2.4">§2.4</a>). +metamethod (see <a href="#meta">Metatables and Metamethods</a>). A comparison <tt>a > b</tt> is translated to <tt>b < a</tt> and <tt>a >= b</tt> is translated to <tt>b <= a</tt>. @@ -1307,7 +1307,7 @@ <b>and</b>, <b>or</b>, and <b>not</b>. The <b>and</b> and <b>or</b> operators consider both <b>false</b> and <b>nil</b> as false and anything else as true. -Like the control structures (see <a href="#3.3.4">§3.3.4</a>), +Like the control structures (see <a href="#control">Control Structures</a>), the <b>not</b> operator requires a boolean value. <p> @@ -1359,7 +1359,7 @@ <p> A program can modify the behavior of the length operator for -any table through the <tt>__len</tt> metamethod (see <a href="#2.4">§2.4</a>). +any table through the <tt>__len</tt> metamethod (see <a href="#meta">Metatables and Metamethods</a>). <p> @@ -1468,7 +1468,7 @@ If the last field in the list has the form <tt>exp</tt> and the expression is a function call or a vararg expression, then all values returned by this expression enter the list consecutively -(see <a href="#3.4.10">§3.4.10</a>). +(see <a href="#fn_calls">Function Calls</a>). <p> @@ -1497,7 +1497,7 @@ Otherwise, the prefixexp "call" metamethod is called, having as first parameter the value of prefixexp, followed by the original call arguments -(see <a href="#2.4">§2.4</a>). +(see <a href="#meta">Metatables and Metamethods</a>). <p> @@ -1690,7 +1690,7 @@ </pre></tt></p> <p> -Results are returned using the <b>return</b> statement (see <a href="#3.3.4">§3.3.4</a>). +Results are returned using the <b>return</b> statement (see <a href="#control">Control Structures</a>). If control reaches the end of a function without encountering a <b>return</b> statement, then the function returns with no results.