<?xml version="1.0"?>
<rss version="2.0">
<channel>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/</link>
<title>helma.org/wiki/Modules and Scopes in Helma NG</title>
<description>Updates for Page helma.org/wiki/Modules and Scopes in Helma NG</description>
<pubDate>Thu, 24 May 2012 15:11:38 +0000</pubDate>
<item>
<title>Version 33</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=33</link>
<description>&lt;div class=&#39;diffbody&#39;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;47&lt;/td&gt;&lt;td&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;import(&amp;quot;&lt;span class=&#39;diffremoved&#39;&gt;helma.database&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;helma/database&lt;/span&gt;&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;53&lt;/td&gt;&lt;td&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;var db = require(&amp;quot;&lt;span class=&#39;diffremoved&#39;&gt;helma.database&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;helma/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>
<pubDate>Sat, 30 May 2009 12:37:40 +0000</pubDate>
<author>bard</author>
</item>
<item>
<title>Version 32</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=32</link>
<description>&lt;div class=&#39;diffbody&#39;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;47&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffremoved&#39;&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;importModule(&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;import(&lt;/span&gt;&amp;quot;helma.database&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;53&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffremoved&#39;&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;importModule(&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;var db = require(&lt;/span&gt;&amp;quot;helma.database&lt;span class=&#39;diffremoved&#39;&gt;&amp;quot;, &amp;quot;db&lt;/span&gt;&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;59&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffremoved&#39;&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;importFromModule(&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;include(&lt;/span&gt;&amp;quot;helma.database&lt;span class=&#39;diffremoved&#39;&gt;&amp;quot;, &amp;quot;getConnection&amp;quot;, &amp;quot;Query&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>
<pubDate>Sun, 25 Jan 2009 19:48:38 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 31</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=31</link>
<description>&lt;div class=&#39;diffbody&#39;&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=&#39;diffremoved&#39;&gt;*ng/background &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;*background and history|ng/background &lt;/span&gt;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>
<pubDate>Thu, 14 Aug 2008 23:45:52 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 30</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=30</link>
<description>&lt;div class=&#39;diffbody&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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>
<pubDate>Thu, 14 Aug 2008 23:45:25 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 29</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=29</link>
<description>&lt;div class=&#39;diffbody&#39;&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&#39;t have to use any special Javascript syntax to denote a namespace. &lt;span class=&#39;diffremoved&#39;&gt;Namespaces are invisible when you&#39;re inside&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;Every script is by its nature a separate scope&lt;/span&gt;, &lt;span class=&#39;diffremoved&#39;&gt;and defined &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;assigned to a namespace &lt;/span&gt;by the &lt;span class=&#39;diffremoved&#39;&gt;file name from the outside&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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&#39;s &lt;span class=&#39;diffremoved&#39;&gt;hardly possible &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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;&lt;span class=&#39;diffremoved&#39;&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;gt;importModuleAs(&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;lt;dt&amp;gt;&amp;lt;b&amp;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>
<pubDate>Fri, 09 May 2008 14:53:55 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 28</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=28</link>
<description>&lt;div class=&#39;diffbody&#39;&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=&#39;diffremoved&#39;&gt;2 &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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=&#39;diffremoved&#39;&gt;2 &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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>
<pubDate>Sat, 19 Apr 2008 01:23:01 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 27</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=27</link>
<description>&lt;div class=&#39;diffbody&#39;&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=&#39;diffremoved&#39;&gt;Helma 2 &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;*Helma NG* &lt;/span&gt;try to loosely imitate the *semantics of python&#39;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&#39;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>
<pubDate>Sat, 19 Apr 2008 01:15:57 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 26</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=26</link>
<description>&lt;ul class=&#39;diffproperties&#39;&gt;&lt;li&gt;Changed &lt;span class=&#39;diffpropname&#39;&gt;tags&lt;/span&gt; to &lt;span class=&#39;diffadded&#39;&gt;helma ng&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;</description>
<pubDate>Fri, 18 Apr 2008 23:06:02 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 25</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=25</link>
<description>&lt;div class=&#39;diffbody&#39;&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width:2em; color:#999;&quot;&gt;48&lt;/td&gt;&lt;td&gt;&lt;span class=&#39;diffremoved&#39;&gt;&amp;lt;dd&amp;gt;Makes &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;lt;dd&amp;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;&lt;span class=&#39;diffremoved&#39;&gt;&amp;lt;dd&amp;gt;Makes &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;lt;dd&amp;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;&lt;span class=&#39;diffremoved&#39;&gt;&amp;lt;dd&amp;gt;Makes &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;&amp;lt;dd&amp;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>
<pubDate>Wed, 16 Apr 2008 00:41:22 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 24</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=24</link>
<description>&lt;div class=&#39;diffbody&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<pubDate>Wed, 16 Apr 2008 00:40:52 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 23</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=23</link>
<description>&lt;div class=&#39;diffbody&#39;&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=&#39;diffremoved&#39;&gt;scoe &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;scope &lt;/span&gt;that uses &lt;span class=&#39;diffremoved&#39;&gt;another &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;a really-shared &lt;/span&gt;scope for the &lt;span class=&#39;diffremoved&#39;&gt;really shared &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;really-shared &lt;/span&gt;stuff.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<pubDate>Wed, 16 Apr 2008 00:34:02 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 22</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=22</link>
<description>&lt;div class=&#39;diffbody&#39;&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 &lt;span class=&#39;diffremoved&#39;&gt;module!&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;module! Also note that the getConnection() function in the last example can still access the Connection() constructor although it&#39;s not included in the importFromModule(). That&#39;s the power of closures!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<pubDate>Wed, 16 Apr 2008 00:32:54 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 21</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=21</link>
<description>&lt;div class=&#39;diffbody&#39;&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=&#39;diffremoved&#39;&gt;scope &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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>
<pubDate>Wed, 16 Apr 2008 00:30:56 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 20</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=20</link>
<description>&lt;div class=&#39;diffbody&#39;&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&#39;t have to use any special Javascript syntax to denote a namespace. &lt;span class=&#39;diffremoved&#39;&gt;The path/name of your script file is &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;Namespaces are invisible when you&#39;re inside, and defined by &lt;/span&gt;the &lt;span class=&#39;diffremoved&#39;&gt;default &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;file &lt;/span&gt;name &lt;span class=&#39;diffremoved&#39;&gt;space&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;from the outside&lt;/span&gt;.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<pubDate>Wed, 16 Apr 2008 00:30:34 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 19</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=19</link>
<description>&lt;div class=&#39;diffbody&#39;&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&#39;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&#39;s import &lt;span class=&#39;diffadded&#39;&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>
<pubDate>Wed, 16 Apr 2008 00:28:56 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 18</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=18</link>
<description>&lt;div class=&#39;diffbody&#39;&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&#39;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=&#39;diffremoved&#39;&gt;the python &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;python&#39;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>
<pubDate>Wed, 16 Apr 2008 00:28:41 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 17</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=17</link>
<description>&lt;div class=&#39;diffbody&#39;&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=&#39;diffremoved&#39;&gt;db&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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=&#39;diffremoved&#39;&gt;db&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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>
<pubDate>Wed, 16 Apr 2008 00:27:17 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 16</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=16</link>
<description>&lt;div class=&#39;diffbody&#39;&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=&#39;diffremoved&#39;&gt;db&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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>
<pubDate>Wed, 16 Apr 2008 00:26:51 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 15</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=15</link>
<description>&lt;div class=&#39;diffbody&#39;&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&#39;t have to use any special Javascript syntax to denote a namespace. &lt;span class=&#39;diffremoved&#39;&gt;Just use the name/location &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;The path/name &lt;/span&gt;of your script &lt;span class=&#39;diffremoved&#39;&gt;file&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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=&#39;diffremoved&#39;&gt;Yet &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;It&#39;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>
<pubDate>Wed, 16 Apr 2008 00:23:41 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 14</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=14</link>
<description>&lt;div class=&#39;diffbody&#39;&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=&#39;diffremoved&#39;&gt;include() function &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;javascript import features &lt;/span&gt;in Helma 2 &lt;span class=&#39;diffremoved&#39;&gt;tries &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;try &lt;/span&gt;to loosely imitate the *semantics of python&#39;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=&#39;diffremoved&#39;&gt;These are some &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;The magic &lt;/span&gt;of the &lt;span class=&#39;diffremoved&#39;&gt;design goals:&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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=&#39;diffremoved&#39;&gt;* By default, the include() function loads scripts into separate scopes matching the library&#39;s script name.&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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=&#39;diffremoved&#39;&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=&#39;diffremoved&#39;&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=&#39;diffremoved&#39;&gt;* If a library is imported into a scope that alreay is defined in the current script&#39;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=&#39;diffremoved&#39;&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=&#39;diffremoved&#39;&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=&#39;diffremoved&#39;&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=&#39;diffremoved&#39;&gt;A simplistic implementation of most of &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;# You don&#39;t have to use any special Javascript syntax to denote a namespace. Just use &lt;/span&gt;the &lt;span class=&#39;diffremoved&#39;&gt;behaviour described above in the Rhino shell may look like this:&lt;/span&gt;&lt;span class=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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=&#39;diffadded&#39;&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>
<pubDate>Wed, 16 Apr 2008 00:21:56 +0000</pubDate>
<author>hannes</author>
</item>
<item>
<title>Version 13</title>
<link>http://helma.org/wiki/Modules+and+Scopes+in+Helma+NG/history.diff?v=13</link>
<description>&lt;div class=&#39;diffbody&#39;&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=&#39;diffremoved&#39;&gt;scriptcore import mechanism &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;include() function &lt;/span&gt;loads scripts into separate scopes matching the library&#39;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=&#39;diffremoved&#39;&gt;import &lt;/span&gt;&lt;span class=&#39;diffadded&#39;&gt;include() &lt;/span&gt;function.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description>
<pubDate>Tue, 15 Apr 2008 17:28:41 +0000</pubDate>
<author>hannes</author>
</item>
</channel>
</rss>

