<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ni on Roads Less Taken</title><link>https://goran.krampe.se/categories/ni/</link><description>Recent content in Ni on Roads Less Taken</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sat, 16 Apr 2016 00:00:00 +0000</lastBuildDate><atom:link href="https://goran.krampe.se/categories/ni/index.xml" rel="self" type="application/rss+xml"/><item><title>Spry Modules</title><link>https://goran.krampe.se/2016/04/16/spry-modules/</link><pubDate>Sat, 16 Apr 2016 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2016/04/16/spry-modules/</guid><description>&lt;p>As discussed in &lt;a href="http://goran.krampe.se/2016/04/09/spry-image-model/" target="_blank" rel="noopener noreferrer">the previous article&lt;/a>
 I want Spry to have a trivially accessible persistence mechanism enabling something similar to the &lt;strong>Smalltalk image model&lt;/strong>, but based on a database. The memory organisation in Spry is basically nested Maps. After dwelling a bit on the inevitable hard question about &lt;strong>modules and namespaces&lt;/strong> I have decided on a design that I hope will turn out simple and reasonably powerful!&lt;/p>
&lt;img src="https://goran.krampe.se/spry/modules.jpg" alt="Modules" style="float:right; margin:0 0 1em 1em;">

&lt;p>Smalltalk has a Dictionary holding all the globals forming &amp;ldquo;the roots&amp;rdquo; of the object memory. In Smalltalk this Dictionary is also itself a global variable accessible as &lt;code>Smalltalk&lt;/code>, in other words &lt;code>Smalltalk == (Smalltalk at: #Smalltalk)&lt;/code>. The primary use of &lt;code>Smalltalk&lt;/code> is to hold all classes by name, so they are all reachable as globals. Obviously &lt;code>Smalltalk&lt;/code> can also hold any kind of object (not just classes) as a global.&lt;/p>
&lt;p>Spry also has such a top level Dictionary, but in Spry we call a Dictionary a &lt;code>Map&lt;/code> to be a little bit more aligned in terminology with other languages (and it&amp;rsquo;s shorter). This top level Map is the &lt;code>root&lt;/code> Map and it is accessible via the word &lt;code>root&lt;/code>. In Spry the &lt;code>root&lt;/code> word is actually bound to a primitive function returning this &lt;code>Map&lt;/code>, so in Spry we also have &lt;code>root == (root at: 'root)&lt;/code>.&lt;/p>
&lt;p>Ok, so Spry has a &lt;code>Map&lt;/code> of globals and one way of using Spry is simply by populating &lt;code>root&lt;/code> with words bound to functions making these functions globally accessible, it&amp;rsquo;s how I have done it so far. Yeah, yeah, I know, but for smaller systems it probably works just fine!&lt;/p>
&lt;p>But&amp;hellip;&lt;/p></description></item><item><title>Spry image model</title><link>https://goran.krampe.se/2016/04/09/spry-image-model/</link><pubDate>Sat, 09 Apr 2016 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2016/04/09/spry-image-model/</guid><description>&lt;p>In developing Spry - &lt;a href="https://goran.krampe.se/ni-is-now-spry" >renamed from Ni&lt;/a>
 - I am getting closer to the &lt;strong>Really Fun Stuff&lt;/strong>.&lt;/p>
&lt;p>As a Smalltalker I dream &amp;ldquo;bigger&amp;rdquo; than just managing source code as text in files&amp;hellip;&lt;/p>
&lt;p>&lt;a href="http://www.azquotes.com/quote/847274" title="Kent Beck quote">&lt;img src="http://www.azquotes.com/picture-quotes/quote-i-mean-source-code-in-files-how-quaint-how-seventies-kent-beck-84-72-74.jpg" alt="I mean, source code in files; how quaint, how seventies! - Kent Beck" />
&lt;/a>&lt;/p>
&lt;p>Smalltalk uses the &amp;ldquo;image model&amp;rdquo; in which the system is alive and running all the time, the full development environment is also live together with your application, and we are in fact modifying object structures when we develop Smalltalk programs. We can also snapshot that object memory onto disk and fire it up somewhere else. Several Lisp implementations have used a similar approach I think.&lt;/p>
&lt;p>The image model has tons of really cool benefits, I don&amp;rsquo;t have time repeating all of them, but a modern implementation of the idea should take a few things into account that was not considered in the 1970s:&lt;/p>
&lt;ul>
&lt;li>The &amp;ldquo;image&amp;rdquo; in Spry will be buildable from source&lt;/li>
&lt;li>You should be able to use Spry without the image mechanism (you can already)&lt;/li>
&lt;li>Spry code will have a readable text format and file structure&lt;/li>
&lt;li>The image model does not have to be all or nothing, it can be partial&lt;/li>
&lt;li>The image mechanism will be a module for the Spry VM, so you can skip it entirely&lt;/li>
&lt;/ul>
&lt;p>Some argue that the image model has downsides - like being an &amp;ldquo;ivory tower&amp;rdquo; incapable of interacting with the outside world. The Smalltalk environments have indeed historically suffered a bit in varying degree, but we can easily find ways around those issues while still &lt;strong>reaping the awesomeness of a fully live&lt;/strong> programming environment, especially if we give the above items proper thought &lt;strong>from the start&lt;/strong>.&lt;/p>
&lt;p>With Spry I think I have a beginning to a novel approach&amp;hellip; as well as taking the above into account.&lt;/p></description></item><item><title>Ni renamed to Spry!</title><link>https://goran.krampe.se/2016/04/08/ni-is-now-spry/</link><pubDate>Fri, 08 Apr 2016 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2016/04/08/ni-is-now-spry/</guid><description>&lt;p>When I started out implementing my own language in Nim I named it &amp;ldquo;Ni&amp;rdquo; without that much thought actually. It was a pun on &amp;ldquo;smaller than Nim&amp;rdquo; (obviously one letter shorter!) and of course with a &lt;a href="https://en.wikipedia.org/wiki/Knights_who_say_Ni" target="_blank" rel="noopener noreferrer">reference to Monty Python&lt;/a>
.&lt;/p>
&lt;p>But&amp;hellip; really, &lt;strong>the name &amp;ldquo;Ni&amp;rdquo; sucks&lt;/strong>. It&amp;rsquo;s hard to say in general and since it&amp;rsquo;s often mentioned together with Nim the confusion is obvious. And it also turned out to be less than optimal to google for.&lt;/p></description></item></channel></rss>