Mercurial Hosting > luan
changeset 685:1e4b0bc0202d
update documentation
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 16 Apr 2016 22:37:47 -0600 |
parents | 41f791e4206d |
children | 33f1b4ad2c9d |
files | website/src/diff.html.luan website/src/manual.html.luan |
diffstat | 2 files changed, 8 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
diff -r 41f791e4206d -r 1e4b0bc0202d website/src/diff.html.luan --- a/website/src/diff.html.luan Sat Apr 16 21:42:19 2016 -0600 +++ b/website/src/diff.html.luan Sat Apr 16 22:37:47 2016 -0600 @@ -104,6 +104,8 @@ <p>Luan only has metatable for tables, not for other types.</p> +<p>Luan does not support the <b>call</b> metamethod. There is nothing that one can do with the <b>call</b> metamethod that can't be done more cleanly with closures, so this was left out.</p> + <h3 heading><a name="gc">Garbage Collection</a></h3> <p>Luan uses Java garbage collection. Luan has no special garbage collection methods.</p> @@ -118,7 +120,7 @@ <h3 heading><a name="lex">Lexical Conventions</a></h3> -<p>Unlike Lua, Luan generally considers the end of a line to be the end of a statement. This catches errors and encourages readability. The exception to this is in paranthesis <em>(...)</em> where the end of line is treated as white space.</p> +<p>Unlike Lua, Luan considers the end of a line to be the end of a statement. This catches errors and encourages readability. If you want to continue a statement on another line, you can use a backslash followed by a newline which will be treated as white space.</p> <p>Luan has exactly the same set of keywords as Lua and has the same other lexical conventions.</p> @@ -199,6 +201,8 @@ <p>Luan does not support Lua's <code>v:name(args)</code> style object-oriented function call. Object oriented programming is done in Luan using closures, so this feature is not needed.</p> +<p>Luan doesn't support <em>proper tail calls</em>. Because Java doesn't support this cleanly, this was left out.</p> + <h4 heading><a name="template_expr">Template Expressions</a></h4> <p>Template expressions are a Luan addition that don't exist in Lua. See <a href="manual.html#template_expr">Template Expressions</a> in the Luan Reference Manual.</p>
diff -r 41f791e4206d -r 1e4b0bc0202d website/src/manual.html.luan --- a/website/src/manual.html.luan Sat Apr 16 21:42:19 2016 -0600 +++ b/website/src/manual.html.luan Sat Apr 16 22:37:47 2016 -0600 @@ -472,16 +472,6 @@ to do the assignment.) </li> -<li><p><b>"call": </b> -The call operation <code>func(args)</code>. - -This event happens when Luan tries to call a table. -The metamethod is looked up in <code>func</code>. -If present, -the metamethod is called with <code>func</code> as its first argument, -followed by the arguments of the original call (<code>args</code>). -</li> - </ul> @@ -526,7 +516,7 @@ Luan ignores spaces and comments between lexical elements (tokens), except as delimiters between names and keywords. -Luan generally considers the end of a line to be the end of a statement. This catches errors and encourages readability. The exception to this is in paranthesis <em>(...)</em> where the end of line is treated as white space. +Luan considers the end of a line to be the end of a statement. This catches errors and encourages readability. If you want to continue a statement on another line, you can use a backslash followed by a newline which will be treated as white space. <p> <em>Names</em> @@ -1493,13 +1483,9 @@ <p> In a function call, first prefixexp and args are evaluated. -If the value of prefixexp has type <em>function</em>, -then this function is called +The value of prefixexp must have type <em>function</em>. +This function is called with the given arguments. -Otherwise, the prefixexp "call" metamethod is called, -having as first parameter the value of prefixexp, -followed by the original call arguments -(see <a href="#meta">Metatables and Metamethods</a>). <p> @@ -1522,32 +1508,6 @@ that is, the argument list is a single literal string. -<p> -A call of the form <code>return <em>functioncall</em></code> is called -a <em>tail call</em>. -Luan implements <em>proper tail calls</em> -(or <em>proper tail recursion</em>): -in a tail call, -the called function reuses the stack entry of the calling function. -Therefore, there is no limit on the number of nested tail calls that -a program can execute. -However, a tail call erases any debug information about the -calling function. -Note that a tail call only happens with a particular syntax, -where the <b>return</b> has one single function call as argument; -this syntax makes the calling function return exactly -the returns of the called function. -So, none of the following examples are tail calls: - -<pre> - return (f(x)) -- results adjusted to 1 - return 2 * f(x) - return x, f(x) -- additional results - f(x); return -- results discarded - return x or f(x) -- results adjusted to 1 -</pre> - - <h4 heading><a name="fn_def">Function Definitions</a></h4>