<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>helma.org/wiki/Modules and Scopes in Helma NG</title>
<pubDate>Mon, 06 Oct 2008 16:07:11 +0200</pubDate>
<description>Updates for Page helma.org/wiki/Modules and Scopes in Helma NG</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/</link>
<item>
<title>Version 31</title>
<pubDate>Thu, 14 Aug 2008 23:45:52 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;70&lt;/td&gt;&lt;td&gt;There is a newer article about the *&lt;span class=&apos;diffadded&apos;&gt;background and history|&lt;/span&gt;ng/background and history* of the Helma NG module system as well as a more up-to-date *technical article|ng/modules and scopes*.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=31</link>
<author>hannes</author>
</item>
<item>
<title>Version 30</title>
<pubDate>Thu, 14 Aug 2008 23:45:25 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;67&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;68&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;=== Further Reading&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;69&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;70&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;There is a newer article about the *ng/background and history* of the Helma NG module system as well as a more up-to-date *technical article|ng/modules and scopes*.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=30</link>
<author>hannes</author>
</item>
<item>
<title>Version 29</title>
<pubDate>Fri, 09 May 2008 14:53:55 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;5&lt;/td&gt;&lt;td&gt;# You don&apos;t have to use any special Javascript syntax to denote a namespace. &lt;span class=&apos;diffremoved&apos;&gt;Namespaces are invisible when you&apos;re inside&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;Every script is by its nature a separate scope&lt;/span&gt;, &lt;span class=&apos;diffremoved&apos;&gt;and defined &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;assigned to a namespace &lt;/span&gt;by the &lt;span class=&apos;diffremoved&apos;&gt;file name from the outside&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;script that imported it&lt;/span&gt;.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;6&lt;/td&gt;&lt;td&gt;# It&apos;s &lt;span class=&apos;diffremoved&apos;&gt;hardly possible &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;virtually impossible &lt;/span&gt;to produce a name collision, as each script lives in its own scope.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;52&lt;/td&gt;&lt;td&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;&lt;span class=&apos;diffremoved&apos;&gt;importModuleAs&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;importModule&lt;/span&gt;(&amp;quot;helma.database&amp;quot;, &amp;quot;db&amp;quot;)&amp;lt;/b&amp;gt;&amp;lt;/dt&amp;gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=29</link>
<author>hannes</author>
</item>
<item>
<title>Version 28</title>
<pubDate>Sat, 19 Apr 2008 01:23:01 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;11&lt;/td&gt;&lt;td&gt;Helma &lt;span class=&apos;diffremoved&apos;&gt;2 &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;NG &lt;/span&gt;implements this by using a &amp;lt;a href=&amp;quot;http://www.mozilla.org/rhino/scopes.html#sharingscopes&amp;quot;&amp;gt;separate top-level scope&amp;lt;/a&amp;gt; for each loaded script file, using a shared top-level scope as prototype. A simplistic implementation of most of the behaviour described above in the Rhino shell may look like this:&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;26&lt;/td&gt;&lt;td&gt;Of course, Helma &lt;span class=&apos;diffremoved&apos;&gt;2 &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;NG &lt;/span&gt;also takes care of script reloading and stuff, and the shared module scope is really a per-thread scope that uses a really-shared scope for the really-shared stuff.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=28</link>
<author>hannes</author>
</item>
<item>
<title>Version 27</title>
<pubDate>Sat, 19 Apr 2008 01:15:57 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;1&lt;/td&gt;&lt;td&gt;The javascript import features in &lt;span class=&apos;diffadded&apos;&gt;*&lt;/span&gt;Helma &lt;span class=&apos;diffremoved&apos;&gt;2 &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;NG* &lt;/span&gt;try to loosely imitate the *semantics of python&apos;s import statement|http://www.effbot.org/zone/import-confusion.htm* in order to allow applications to be written in a truly modular way. The magic of python&apos;s import statement is that a script never has to do anything special in order to avoid name clashes with other scripts, because every script lives in its one top level scope by default. &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=27</link>
<author>hannes</author>
</item>
<item>
<title>Version 26</title>
<pubDate>Fri, 18 Apr 2008 23:06:02 +0200</pubDate>
<description>&lt;ul class=&apos;diffproperties&apos;&gt;&lt;li&gt;Changed &lt;span class=&apos;diffpropname&apos;&gt;tags&lt;/span&gt; to &lt;span class=&apos;diffadded&apos;&gt;helma ng&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=26</link>
<author>hannes</author>
</item>
<item>
<title>Version 25</title>
<pubDate>Wed, 16 Apr 2008 00:41:22 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;48&lt;/td&gt;&lt;td&gt;&amp;lt;dd&amp;gt;&lt;span class=&apos;diffremoved&apos;&gt;Makes &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;This makes &lt;/span&gt;the functions defined in helma/database.js available in the current scope as &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;54&lt;/td&gt;&lt;td&gt;&amp;lt;dd&amp;gt;&lt;span class=&apos;diffremoved&apos;&gt;Makes &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;This makes &lt;/span&gt;the functions defined in helma/database.js available in the current scope as &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;60&lt;/td&gt;&lt;td&gt;&amp;lt;dd&amp;gt;&lt;span class=&apos;diffremoved&apos;&gt;Makes &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;This makes &lt;/span&gt;the functions defined in helma/database.js available in the current scope as &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=25</link>
<author>hannes</author>
</item>
<item>
<title>Version 24</title>
<pubDate>Wed, 16 Apr 2008 00:40:52 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;44&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;Then consider the following statements in another script file:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;45&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=24</link>
<author>hannes</author>
</item>
<item>
<title>Version 23</title>
<pubDate>Wed, 16 Apr 2008 00:34:02 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;26&lt;/td&gt;&lt;td&gt;Of course, Helma 2 also takes care of script reloading and stuff, and the shared module scope is really a per-thread &lt;span class=&apos;diffremoved&apos;&gt;scoe &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;scope &lt;/span&gt;that uses &lt;span class=&apos;diffremoved&apos;&gt;another &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;a really-shared &lt;/span&gt;scope for the &lt;span class=&apos;diffremoved&apos;&gt;really &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;really-&lt;/span&gt;shared stuff.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=23</link>
<author>hannes</author>
</item>
<item>
<title>Version 22</title>
<pubDate>Wed, 16 Apr 2008 00:32:54 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;64&lt;/td&gt;&lt;td&gt;Note that the functions in helma/database.js do not care in which namespace they are loaded. They only see what is defined in their local file, and in the global scope shared by all modules. The scope that loaded the module is absolutely invisible to the loaded module!&lt;span class=&apos;diffadded&apos;&gt; Also note that the getConnection() function in the last example can still access the Connection() constructor although it&apos;s not included in the importFromModule(). That&apos;s the power of closures!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=22</link>
<author>hannes</author>
</item>
<item>
<title>Version 21</title>
<pubDate>Wed, 16 Apr 2008 00:30:56 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;7&lt;/td&gt;&lt;td&gt;# Since scripts live in their own &lt;span class=&apos;diffremoved&apos;&gt;scope &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;scope, &lt;/span&gt;imported scripts are only visible to the scripts that imported them.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=21</link>
<author>hannes</author>
</item>
<item>
<title>Version 20</title>
<pubDate>Wed, 16 Apr 2008 00:30:34 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;5&lt;/td&gt;&lt;td&gt;# You don&apos;t have to use any special Javascript syntax to denote a namespace. &lt;span class=&apos;diffremoved&apos;&gt;The path/name of your script file is &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;Namespaces are invisible when you&apos;re inside, and defined by &lt;/span&gt;the &lt;span class=&apos;diffremoved&apos;&gt;default &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;file &lt;/span&gt;name &lt;span class=&apos;diffremoved&apos;&gt;space&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;from the outside&lt;/span&gt;.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=20</link>
<author>hannes</author>
</item>
<item>
<title>Version 19</title>
<pubDate>Wed, 16 Apr 2008 00:28:56 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;1&lt;/td&gt;&lt;td&gt;The javascript import features in Helma 2 try to loosely imitate the *semantics of python&apos;s import statement|http://www.effbot.org/zone/import-confusion.htm* in order to allow applications to be written in a truly modular way. The magic of python&apos;s import &lt;span class=&apos;diffadded&apos;&gt;statement &lt;/span&gt;is that a script never has to do anything special in order to avoid name clashes with other scripts, because every script lives in its one top level scope by default. &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=19</link>
<author>hannes</author>
</item>
<item>
<title>Version 18</title>
<pubDate>Wed, 16 Apr 2008 00:28:41 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;1&lt;/td&gt;&lt;td&gt;The javascript import features in Helma 2 try to loosely imitate the *semantics of python&apos;s import statement|http://www.effbot.org/zone/import-confusion.htm* in order to allow applications to be written in a truly modular way. The magic of &lt;span class=&apos;diffremoved&apos;&gt;the python &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;python&apos;s import &lt;/span&gt;is that a script never has to do anything special in order to avoid name clashes with other scripts, because every script lives in its one top level scope by default. &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=18</link>
<author>hannes</author>
</item>
<item>
<title>Version 17</title>
<pubDate>Wed, 16 Apr 2008 00:27:17 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;51&lt;/td&gt;&lt;td&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;importModuleAs(&amp;quot;helma.&lt;span class=&apos;diffremoved&apos;&gt;db&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;database&lt;/span&gt;&amp;quot;, &amp;quot;db&amp;quot;)&amp;lt;/b&amp;gt;&amp;lt;/dt&amp;gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;57&lt;/td&gt;&lt;td&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;importFromModule(&amp;quot;helma.&lt;span class=&apos;diffremoved&apos;&gt;db&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;database&lt;/span&gt;&amp;quot;, &amp;quot;getConnection&amp;quot;, &amp;quot;Query&amp;quot;)&amp;lt;/b&amp;gt;&amp;lt;/dt&amp;gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=17</link>
<author>hannes</author>
</item>
<item>
<title>Version 16</title>
<pubDate>Wed, 16 Apr 2008 00:26:51 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;45&lt;/td&gt;&lt;td&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;importModule(&amp;quot;helma.&lt;span class=&apos;diffremoved&apos;&gt;db&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;database&lt;/span&gt;&amp;quot;)&amp;lt;/b&amp;gt;&amp;lt;/dt&amp;gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=16</link>
<author>hannes</author>
</item>
<item>
<title>Version 15</title>
<pubDate>Wed, 16 Apr 2008 00:23:41 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;5&lt;/td&gt;&lt;td&gt;# You don&apos;t have to use any special Javascript syntax to denote a namespace. &lt;span class=&apos;diffremoved&apos;&gt;Just use the name&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;The path&lt;/span&gt;/&lt;span class=&apos;diffremoved&apos;&gt;location &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;name &lt;/span&gt;of your script &lt;span class=&apos;diffremoved&apos;&gt;file&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;file is the default name space&lt;/span&gt;.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;6&lt;/td&gt;&lt;td&gt;# &lt;span class=&apos;diffremoved&apos;&gt;Yet &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;It&apos;s &lt;/span&gt;hardly possible to produce a name collision, as each script lives in its own scope.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=15</link>
<author>hannes</author>
</item>
<item>
<title>Version 14</title>
<pubDate>Wed, 16 Apr 2008 00:21:56 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;1&lt;/td&gt;&lt;td&gt;The &lt;span class=&apos;diffremoved&apos;&gt;include() function &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;javascript import features &lt;/span&gt;in Helma 2 &lt;span class=&apos;diffremoved&apos;&gt;tries &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;try &lt;/span&gt;to loosely imitate the *semantics of python&apos;s import statement|http://www.effbot.org/zone/import-confusion.htm* in order to allow applications to be written in a truly modular way. &lt;span class=&apos;diffremoved&apos;&gt;These are some &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;The magic &lt;/span&gt;of the &lt;span class=&apos;diffremoved&apos;&gt;design goals:&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;python is that a script never has to do anything special in order to avoid name clashes with other scripts, because every script lives in its one top level scope by default. &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;3&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffremoved&apos;&gt;* By default, the include() function loads scripts into separate scopes matching the library&apos;s script name.&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;To sum it up:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;4&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffremoved&apos;&gt;* The scope name can be overridden by passing a second argument to the include() function.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;5&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffremoved&apos;&gt;* Never is a library imported into the top level scope.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;6&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffremoved&apos;&gt;* If a library is imported into a scope that alreay is defined in the current script&apos;s code, the previous value is overwritten.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;7&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffremoved&apos;&gt;* Imported libraries are local to the script that imported them (which is possible because the script lives itself in its own scope).&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;8&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffremoved&apos;&gt;* (If the same library is imported from different scripts within one application (possibly using different scope names), only one version of the library is instanciated and shared among the importing scripts.)?&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;9&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffremoved&apos;&gt;* Imported libraries are aware of their location so they can use relative path names for local imports and references to other resources.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;5&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffremoved&apos;&gt;A simplistic implementation of most of &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;# You don&apos;t have to use any special Javascript syntax to denote a namespace. Just use &lt;/span&gt;the &lt;span class=&apos;diffremoved&apos;&gt;behaviour described above in the Rhino shell may look like this:&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;name/location of your script file.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;6&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;# Yet hardly possible to produce a name collision, as each script lives in its own scope.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;7&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;# Since scripts live in their own scope imported scripts are only visible to the scripts that imported them.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;7&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;=== Implementation &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;8&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;9&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;Helma 2 implements this by using a &amp;lt;a href=&amp;quot;http://www.mozilla.org/rhino/scopes.html#sharingscopes&amp;quot;&amp;gt;separate top-level scope&amp;lt;/a&amp;gt; for each loaded script file, using a shared top-level scope as prototype. A simplistic implementation of most of the behaviour described above in the Rhino shell may look like this:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;10&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;21&lt;/td&gt;&lt;td&gt;Of course, Helma 2 also takes care of script reloading and stuff&lt;span class=&apos;diffadded&apos;&gt;, and the shared module scope is really a per-thread scoe that uses another scope for the really shared stuff&lt;/span&gt;.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;22&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;23&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;=== Example&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;24&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;25&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;Suppose there is a Javascript file called &amp;lt;code&amp;gt;helma/database.js&amp;lt;/code&amp;gt; with the following content:&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;26&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;27&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; function getConnection(...) {&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;28&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ....&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;29&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;30&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;31&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; function Connection(...) {&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;32&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ...&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;33&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;34&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;35&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; function Query(...) {&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;36&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ...&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;37&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;38&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;39&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;lt;dl&amp;gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;40&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;importModule(&amp;quot;helma.db&amp;quot;)&amp;lt;/b&amp;gt;&amp;lt;/dt&amp;gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;41&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;lt;dd&amp;gt;Makes the functions defined in helma/database.js available in the current scope as &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;42&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; helma.database.getConnection()&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;43&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; helma.database.Connection()&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;44&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; helma.database.Query()&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;45&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;lt;/dd&amp;gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;46&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;importModuleAs(&amp;quot;helma.db&amp;quot;, &amp;quot;db&amp;quot;)&amp;lt;/b&amp;gt;&amp;lt;/dt&amp;gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;47&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;lt;dd&amp;gt;Makes the functions defined in helma/database.js available in the current scope as &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;48&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; db.getConnection()&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;49&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; db.Connection()&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;50&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; db.Query()&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;51&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;lt;/dd&amp;gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;52&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;importFromModule(&amp;quot;helma.db&amp;quot;, &amp;quot;getConnection&amp;quot;, &amp;quot;Query&amp;quot;)&amp;lt;/b&amp;gt;&amp;lt;/dt&amp;gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;53&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;lt;dd&amp;gt;Makes the functions defined in helma/database.js available in the current scope as &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;54&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; getConnection()&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;55&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;nbsp; Query()&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;56&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;lt;/dd&amp;gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;57&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&amp;lt;/dl&amp;gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;58&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;59&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffadded&apos;&gt;Note that the functions in helma/database.js do not care in which namespace they are loaded. They only see what is defined in their local file, and in the global scope shared by all modules. The scope that loaded the module is absolutely invisible to the loaded module!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=14</link>
<author>hannes</author>
</item>
<item>
<title>Version 13</title>
<pubDate>Tue, 15 Apr 2008 17:28:41 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;3&lt;/td&gt;&lt;td&gt;* By default, the &lt;span class=&apos;diffremoved&apos;&gt;scriptcore import mechanism &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;include() function &lt;/span&gt;loads scripts into separate scopes matching the library&apos;s script name.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;4&lt;/td&gt;&lt;td&gt;* The scope name can be overridden by passing a second argument to the &lt;span class=&apos;diffremoved&apos;&gt;import &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;include() &lt;/span&gt;function.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=13</link>
<author>hannes</author>
</item>
<item>
<title>Version 12</title>
<pubDate>Tue, 15 Apr 2008 17:24:26 +0200</pubDate>
<description>&lt;ul class=&apos;diffproperties&apos;&gt;&lt;li&gt;Set &lt;span class=&apos;diffpropname&apos;&gt;tags&lt;/span&gt; to &lt;span class=&apos;diffadded&apos;&gt;helma 2&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=12</link>
<author>hannes</author>
</item>
<item>
<title>Version 11</title>
<pubDate>Tue, 15 Apr 2008 17:23:20 +0200</pubDate>
<description>&lt;div class=&apos;diffbody&apos;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;1&lt;/td&gt;&lt;td&gt;&lt;span class=&apos;diffremoved&apos;&gt;ScriptCore is an experimental, next-generation script management module for the Rhino Javascript engine.&lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;The include()&lt;/span&gt;&amp;nbsp;&lt;span class=&apos;diffremoved&apos;&gt;ScriptCore &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;function in Helma 2 &lt;/span&gt;tries to loosely imitate the *semantics of python&apos;s import statement|http://www.effbot.org/zone/import-confusion.htm* in order to allow applications to be written in a truly modular way. These are some of the design goals:&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;26&lt;/td&gt;&lt;td&gt;Of course, &lt;span class=&apos;diffremoved&apos;&gt;ScriptCore &lt;/span&gt;&lt;span class=&apos;diffadded&apos;&gt;Helma 2 &lt;/span&gt;also takes care of script reloading and stuff.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<link>http://dev.helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=11</link>
<author>hannes</author>
</item>
</channel>
</rss>
