<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Spry on Roads Less Taken</title><link>https://goran.krampe.se/categories/spry/</link><description>Recent content in Spry on Roads Less Taken</description><generator>Hugo</generator><language>en</language><lastBuildDate>Wed, 21 Apr 2021 00:00:00 +0000</lastBuildDate><atom:link href="https://goran.krampe.se/categories/spry/index.xml" rel="self" type="application/rss+xml"/><item><title>Spry Error Handling</title><link>https://goran.krampe.se/2021/04/21/spry-error-handling/</link><pubDate>Wed, 21 Apr 2021 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2021/04/21/spry-error-handling/</guid><description>&lt;p>Work on &lt;a href="https://sprylang.se" target="_blank" rel="noopener noreferrer">Spry&lt;/a>
 continues&amp;hellip; in small spurts. :) One thing that I have pushed ahead of me for far too long is &lt;strong>error handling&lt;/strong>. People interested in Spry have been asking about it and yes, I decided to start getting a handle on it.&lt;/p>
&lt;p>In fact, I wrote this article &lt;strong>last year&lt;/strong> but forgot to get it done and published!&lt;/p>
&lt;p>Error handling is an interesting topic, earlier it wasn&amp;rsquo;t really much controversy around it but the advent of new techniques (Optionals etc) in combination with languages making&amp;hellip; &amp;ldquo;interesting&amp;rdquo; choices (I am looking at you Go) has made this subject fairly hot. So what do we want in Spry??&lt;/p></description></item><item><title>Revisiting Spry</title><link>https://goran.krampe.se/2020/06/05/revisiting-spry/</link><pubDate>Fri, 05 Jun 2020 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2020/06/05/revisiting-spry/</guid><description>&lt;p>After a period of slower progress I got reignited regarding &lt;a href="https://sprylang.se" target="_blank" rel="noopener noreferrer">Spry&lt;/a>
. So far I have written &lt;a href="http://goran.krampe.se/categories/spry/" target="_blank" rel="noopener noreferrer">a lot of articles&lt;/a>
 about Spry, and during this time things have evolved and changed.&lt;/p>
&lt;p>So I am now trying to &amp;ldquo;clean house&amp;rdquo; on where Spry stands today. This sweep through the old articles is a first step, then I will update the language manual to be 100% in sync with the implementation.&lt;/p>
&lt;p>Let&amp;rsquo;s go through the articles from the beginning!&lt;/p></description></item><item><title>Benchmarking Spry vs Squeak</title><link>https://goran.krampe.se/2016/08/26/benchmarking-spry-vs-squeak/</link><pubDate>Fri, 26 Aug 2016 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2016/08/26/benchmarking-spry-vs-squeak/</guid><description>&lt;p>&lt;a href="http://sprylang.org" target="_blank" rel="noopener noreferrer">Spry&lt;/a>
 is evolving quite nicely during my night hours. Focusing on performance is however still premature, but I do want to verify that I am not barking up the wrong tree, like &amp;hellip; in the wrong forest even. So I make trivial benchmarks from time to time, just to see and learn.&lt;/p>
&lt;p>Some background on the Spry implementation may be interesting. Spry is implemented in Nim as a &lt;strong>direct AST interpreter&lt;/strong>, it&amp;rsquo;s not a JIT, in only about 2000 lines of code. It has a &lt;strong>recursive classic &amp;ldquo;naive&amp;rdquo; design&lt;/strong> and uses a &lt;strong>spaghetti stack of activation records&lt;/strong>, all allocated on the heap relying fully on Nim&amp;rsquo;s GC to do it&amp;rsquo;s work. It also relies on Nim&amp;rsquo;s method &lt;strong>dynamic dispatch&lt;/strong> in the interpreter loop for dispatching on the different AST nodes. Blocks are true closures and control structures like &lt;code>timesRepeat:&lt;/code> are implemented as primitives, normally &lt;strong>not cheating&lt;/strong>. Suffice to say, there are LOTS of things we can do to make Spry run faster!&lt;/p>
&lt;p>The philosophy of implementation is to keep Spry very small and &amp;ldquo;shallow&amp;rdquo; which means we rely as much as possible on the shoulders of others. In this case, primarily Nim and it&amp;rsquo;s superb features, performance and standard library.&lt;/p>
&lt;p>Enough jibbering, let&amp;rsquo;s do some silly damn lies - ehrm, I mean silly tests!&lt;/p></description></item><item><title>Is Spry a Smalltalk?</title><link>https://goran.krampe.se/2016/07/19/is-spry-a-smalltalk/</link><pubDate>Tue, 19 Jul 2016 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2016/07/19/is-spry-a-smalltalk/</guid><description>&lt;p>I love &lt;a href="http://world.st" target="_blank" rel="noopener noreferrer">Smalltalk&lt;/a>
 and I have been in love with it since approximately 1994. I have used VisualWorks, VisualAge (IBM Smalltalk), Dolphin Smalltalk, GemStone, &lt;a href="http://squeak.org" target="_blank" rel="noopener noreferrer">Squeak&lt;/a>
 and &lt;a href="http://pharo.org" target="_blank" rel="noopener noreferrer">Pharo&lt;/a>
 quite a lot, and I was very active in the Squeak community for a long period.&lt;/p>
&lt;p>But the last few years, finally, I have started to feel the &amp;ldquo;burn&amp;rdquo;&amp;hellip; as in &lt;a href="http://gagne.homedns.org/~tgagne/contrib/EarlyHistoryST.html#29" target="_blank" rel="noopener noreferrer">&amp;ldquo;Let&amp;rsquo;s burn our disk packs!&amp;rdquo;&lt;/a>
. And last year I started doing something about it - and the result is &lt;a href="http://sprylang.org" target="_blank" rel="noopener noreferrer">Spry&lt;/a>
. Spry is only at version 0.break-your-hd and several key parts are still missing, but its getting interesting already.&lt;/p>
&lt;p>&lt;strong>Now&amp;hellip; is Spry a Smalltalk? And what would that even mean?&lt;/strong>&lt;/p>
&lt;p>I think the reason I am writing this article is because I am feeling a slight frustration that not more people in the Smalltalk community find Spry interesting. :)&lt;/p>
&lt;p>And sure, who am I to think Spry is anything remotely interesting&amp;hellip; but I would have loved more interest. It may of course change when Spry starts being useful&amp;hellip; or perhaps the lack of interest is because it&amp;rsquo;s not &amp;ldquo;a Smalltalk&amp;rdquo;?&lt;/p>
&lt;h2 id="smalltalk-family">
 Smalltalk family
 &lt;a class="heading-link" href="#smalltalk-family">
 &lt;i class="fa-solid fa-link" aria-hidden="true" title="Link to heading">&lt;/i>
 &lt;span class="sr-only">Link to heading&lt;/span>
 &lt;/a>
&lt;/h2>
&lt;p>The Smalltalk family of languages has a fair bit of variation, for example &lt;a href="http://www.selflanguage.org" target="_blank" rel="noopener noreferrer">Self&lt;/a>
 is clearly in this family, although it doesn&amp;rsquo;t even have classes, but it maintains a similar &amp;ldquo;feel&amp;rdquo; and shares several Smalltalk &amp;ldquo;values&amp;rdquo;. There have been a lot of Smalltalks over the years, even at PARC they made different variants before releasing Smalltalk-80.&lt;/p>
&lt;p>&lt;strong>So&amp;hellip; if we look at Spry, can it be considered a member of the Smalltalk family?&lt;/strong>&lt;/p>
&lt;p>There is an &lt;a href="http://wiki.squeak.org/squeak/172" target="_blank" rel="noopener noreferrer">ANSI standard&lt;/a>
 of Smalltalk - but not many people care about it, except for some vendors perhaps. I should note however that &lt;a href="http://www.seaside.st" target="_blank" rel="noopener noreferrer">Seaside&lt;/a>
 apparently (I think) has brought around a certain focus on the ANSI standard since every Smalltalk implementation on earth wants to be able to run Seaside and Seaside tries to enforce relying on the ANSI standard (correct me if I am wrong).&lt;/p>
&lt;p>Most Smalltalk implementations share a range of characteristics, and a lot of them also follow the ANSI standard, but they can still differ on pretty major points.&lt;/p>
&lt;p>My &lt;strong>personal take&lt;/strong> on things in Smalltalk that are pretty darn important and/or unique are:&lt;/p>
&lt;ol>
&lt;li>Everything is an object including meta levels&lt;/li>
&lt;li>A solid model for object oriented programming&lt;/li>
&lt;li>The image model&lt;/li>
&lt;li>100% live system&lt;/li>
&lt;li>The browser based IDE with advanced cross referencing, workspaces and debuggers&lt;/li>
&lt;li>The keyword syntax and message cascades&lt;/li>
&lt;li>Message based execution model&lt;/li>
&lt;li>Dynamic typing and polymorphism&lt;/li>
&lt;li>Closures everywhere with lightweight syntax and non local return&lt;/li>
&lt;li>Very capable Collections and a good standard library&lt;/li>
&lt;/ol>
&lt;p>Not all Smalltalks cover all 10. For example, there are several Smalltalks without the image model and without a browser based IDE. Self and Slate and other prototypical derivatives don&amp;rsquo;t have classes. Some Smalltalks have much less evolved class libraries for sure, and some are more shallow in the &amp;ldquo;turtle department&amp;rdquo;.&lt;/p>
&lt;p>In Spry we are deviating on a range of these points, but we are also definitely &lt;strong>matching some&lt;/strong> of them!&lt;/p></description></item><item><title>Spry Performance</title><link>https://goran.krampe.se/2016/05/24/spry-performance/</link><pubDate>Tue, 24 May 2016 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2016/05/24/spry-performance/</guid><description>&lt;p>When writing Spry I am so far mainly ignoring performance. The general execution of Spry code will be a regular interpreter (although stackless I hope) and not a JIT. But that doesn&amp;rsquo;t prevent us from playing around and learning something!&lt;/p>
&lt;p>In this article I do some silly experiments around interpreter startup time and fooling around with 40 million element arrays. As usual, I am fully aware that the languages (Pharo Smalltalk, NodeJS, Python) I compare with a) have lots of other ways to do things b) may not have been used exactly as someone else would have done it. A truck load of salt required. Now&amp;hellip; let&amp;rsquo;s go!&lt;/p>
&lt;img src="https://goran.krampe.se/spry/thetruth.jpg" alt="The" style="display:block; margin:0 auto;"></description></item><item><title>Spry vs Allen</title><link>https://goran.krampe.se/2016/05/14/spry-vs-allen/</link><pubDate>Sat, 14 May 2016 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2016/05/14/spry-vs-allen/</guid><description>&lt;p>Allen Wirfs-Brock &lt;a href="http://www.wirfs-brock.com/allen/posts/754" target="_blank" rel="noopener noreferrer">wrote down a bullet list&lt;/a>
 of what he thought actually made it possible for the Alan Kay team to &lt;a href="http://worrydream.com/EarlyHistoryOfSmalltalk/" target="_blank" rel="noopener noreferrer">create Smalltalk&lt;/a>
, and many other ground breaking things, at Xerox PARC in the 70s. Let&amp;rsquo;s take a look at &lt;strong>his bullets one by one&lt;/strong> and see how it applies to Spry and my puny little effort around it :)&lt;/p>
&lt;img src="https://goran.krampe.se/spry/assume.jpg" alt="Assume" style="display:block; margin:0 auto;"></description></item><item><title>Spry Modules, part II</title><link>https://goran.krampe.se/2016/05/03/spry-modules-ii/</link><pubDate>Tue, 03 May 2016 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2016/05/03/spry-modules-ii/</guid><description>&lt;p>In the &lt;a href="http://goran.krampe.se/2016/04/16/spry-modules" target="_blank" rel="noopener noreferrer">last article&lt;/a>
 I outlined a simple &lt;strong>model of modules&lt;/strong> and that is kinda implemented but needs a few fixes. The next step is how to find and combine modules and this is an area where I want to push the envelope a bit. Most popular package/module systems today are quite trivial in nature. Often it&amp;rsquo;s a command line tool that queries central catalog(s) and then proceeds by downloading code in the form of source files onto disk. Then the compiler or runtime environment finds and loads the code by simply looking for files on disk. There are several parts of this that are very primitive.&lt;/p>
&lt;p>When I built &lt;a href="http://map.squeak.org" target="_blank" rel="noopener noreferrer">SqueakMap&lt;/a>
 waaay back I was already then tainted with the idea of &lt;a href="https://gemtalksystems.com" target="_blank" rel="noopener noreferrer">shared object models&lt;/a>
 and one of the primary ideas in SqueakMap was to make sure each local Smalltalk environment got a full live object model of the catalog which then could be queried, viewed and reasoned about inside the Smalltalk environment. Much more powerful than a bunch of JSON files on disk. This led to the approach of downloading the full catalog in a serialized form - and then loading it into &lt;a href="http://www.squeak.org" target="_blank" rel="noopener noreferrer">Squeak&lt;/a>
.&lt;/p>
&lt;p>With &lt;a href="http://sprylang.org" target="_blank" rel="noopener noreferrer">Spry&lt;/a>
 I want us to create a simpler meta model - at least for starters - but with an even smarter infrastructure backing it&amp;hellip;&lt;/p></description></item><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><item><title>Adding objects to Ni!</title><link>https://goran.krampe.se/2015/09/25/adding-objects-to-ni/</link><pubDate>Fri, 25 Sep 2015 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2015/09/25/adding-objects-to-ni/</guid><description>&lt;p>So&amp;hellip; Ni has almost reached the point where I can see objects appearing. The following describes the design I &lt;strong>currently&lt;/strong> have in mind, read it and tell me what you think so I can scrap it and start over ;)&lt;/p>
&lt;img src="https://goran.krampe.se/ni/ni.png" alt="Ni" style="float:right; margin:0 0 1em 1em;"></description></item><item><title>Ni design decisions!</title><link>https://goran.krampe.se/2015/09/23/ni-design-decisions/</link><pubDate>Wed, 23 Sep 2015 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2015/09/23/ni-design-decisions/</guid><description>&lt;p>So&amp;hellip; my little Ni language got some attention since it was first &lt;a href="https://news.ycombinator.com/item?id=10235688" target="_blank" rel="noopener noreferrer">on Hackernews&lt;/a>
, then &lt;a href="http://www.theregister.co.uk/2015/09/18/we_are_the_knights_who_code_ni/" target="_blank" rel="noopener noreferrer">TheRegister&lt;/a>
, all over Twitter and also &lt;a href="https://www.reddit.com/r/programming/comments/3lfpym/ni_a_language_influenced_by_smalltalk_written_in/" target="_blank" rel="noopener noreferrer">Reddit&lt;/a>
.&lt;/p>
&lt;p>But I think it managed to come relatively unscathed out of it, although it &lt;strong>REALLY is pre-alpha-not-even-complete-eats-your-harddrive early&lt;/strong> and you know, I really have no idea if it ever will go the distance since it takes quite a bit of work to get a language to actually be used. But I am going to stick with it.&lt;/p>
&lt;p>Anyway, I have been experimenting with &amp;ldquo;arg words&amp;rdquo; and &amp;ldquo;lookup scoping&amp;rdquo; while thinking about how to add objects, and a few other things. This article doesn&amp;rsquo;t introduce how I want to do objects, but the next one does (I split it in two). This article however covers a bunch of loose ends and my ideas on how to tackle them in Ni. And I will try to make this understandable even if you don&amp;rsquo;t know Ni. ;)&lt;/p></description></item><item><title>Guts of Ni</title><link>https://goran.krampe.se/2015/09/22/guts-of-ni/</link><pubDate>Tue, 22 Sep 2015 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2015/09/22/guts-of-ni/</guid><description>&lt;p>This article describes some core parts of the current implementation of the Ni (now known as &lt;a href="https://goran.krampe.se/spry" >Spry&lt;/a>
) language. It&amp;rsquo;s not a tutorial, introduction or manual. It&amp;rsquo;s in &lt;strong>fact kinda incoherent - but so is Ni&lt;/strong> :)&lt;/p></description></item><item><title>Who says Ni?</title><link>https://goran.krampe.se/2015/09/16/who-says-ni/</link><pubDate>Wed, 16 Sep 2015 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2015/09/16/who-says-ni/</guid><description>&lt;p>Ni is my &lt;a href="https://goran.krampe.se/spry" >own little language&lt;/a>
 heavily influenced by &lt;a href="http://www.world.st" target="_blank" rel="noopener noreferrer">Smalltalk&lt;/a>
 but also other sources like Rebol, Forth, Lisp, Self and Nim. Ni is a bit strange, but it&amp;rsquo;s not academic and really meant to become something useful.&lt;/p>
&lt;p>So put on your helmet and let me take you to the shrubbery&amp;hellip;&lt;/p></description></item></channel></rss>