diff website/src/diff.html.luan @ 512:d96944467ffc

update documentation for luan changes
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 22 May 2015 16:08:23 -0600
parents 7bc63886d4f2
children 0dfc01d8d42d
line wrap: on
line diff
--- a/website/src/diff.html.luan	Fri May 22 10:47:56 2015 -0600
+++ b/website/src/diff.html.luan	Fri May 22 16:08:23 2015 -0600
@@ -44,6 +44,7 @@
 	<a href="#lang">The Language</a>
 	<ul>
 		<li><a href="#lex">Lexical Conventions</a></li>
+		<li><a href="#vars">Variables</a></li>
 		<li>
 			<a href="#stmt">Statements</a>
 			<ul>
@@ -93,7 +94,7 @@
 
 <h3 <%=heading_options%> ><a name="env">Environments</a></h3>
 
-<p>Luan has an <tt>_ENV</tt> which is like its Lua equivalent.  However Luan has no global environment at all, no <tt>_G</tt>.</p>
+<p>Luan has no global environment at all, no <tt>_G</tt>.  By default, Luan doesn't define <tt>_ENV</tt> either, but if you define it as a local table in a chunk, then it acts like it does in Lua.  When <tt>_ENV</tt> isn't defined, there are no global variables and an unrecognized variable name produces a compile error.</p>
 
 <p>Every module is initialized with two local functions: <tt>require</tt> and <tt>java</tt>.  The module then uses these functions to get access to whatever else it needs.</p>
 
@@ -123,6 +124,11 @@
 
 <p>Luan has exactly the same set of keywords as Lua and has the same other lexical conventions.</p>
 
+<h3 <%=heading_options%> ><a name="vars">Variables</a></h3>
+
+<p>
+By default, there are no global variables and an undefined variable produces a compile error.  To enable global variables, one must define <tt>_ENV</tt>.  Avoiding global variables makes it much easier to catch errors at compile time.
+
 <h3 <%=heading_options%> ><a name="stmt">Statements</a></h3>
 
 <p>Most statements in Luan are the same as Lua.  Only those statements that differ will be listed here.</p>