Roads Less Taken

A blend of programming, boats and life.

I Missed Nim

| Comments

A year ago I wrote an article trying to round up new languages since year 2000 and what I think of them by just… glancing at them, or otherwise playing with them. I ended up sifting out the 5 most interesting in my not so humble opinion - Go, Rust, Dart and Julia. Now a year has passed and…

I discover that I missed Nim(Nimrod)!

Nim was born somewhere around 2006-ish and is clearly a very serious language to consider, but is going suspiciously under the radar. Having reviewed this language more closely (and still doing so) I can safely say that for me it actually easily tops this list.

I have already posted a few articles about Nim, but this one is meant as a followup to that article trying to make amends :).

NOTE: Technically Nim is still called Nimrod up to and including the 0.9.6-release that was done yesterday. But for the upcoming 0.10.0 and onward its Nim. Short and sweet.

Nim Wrapping C

| Comments

Nim has all the language mechanisms needed to smoothly interoperate with C and C++. The rather large collection of wrapped C libraries (and that’s only those in the standard libs) is also a testament to this fact. In this article I explain my personal findings testing out the waters of wrapping a simple C library.

The basic approach to wrapping a simple C library is:

  1. Install Nim.
  2. Install c2nim using Babel or manually clone c2nim from github and build it.
  3. Use c2nim to translate the C header file(s) to a so called Nim wrapper.
  4. Make a small test showing it works.
  5. Write a so called “impure” intermediary library that uses the wrapper (next article)
  6. Make a test green and declare Victory (next article)

Okidoki… (roll up sleeves)

Bootstrapping Nim(rod)

| Comments

Technically Nim is still called Nimrod up to and including upcoming bugfix version 0.9.6. But then with the next version 0.10.0 it will be just Nim. Currently Nimrod is at 0.9.4. And oh, the current development version is 0.9.5 which will become 0.9.6 when released - the “odd and even” versioning scheme.

Nim can be a bit funky to get started with, typically due to a slight lack of documentation in certain areas that may be obvious to Nimmers (or Nimsters? Knights who say Nim?). This article tries to fill a few mental holes in the first steps.

Also, Nimsters like to do it in Nim - and often the reasons for this are very good, like maintaining portability or minimizing dependencies. Just don’t expect the classic autoconf dance here. As a Smalltalker I am fully versed in the NIH syndrome - which of course doesn’t always have to be a bad thing. Thankfully Nimmers also seem to balance it with a strong tradition of standing on the shoulders of giants.

So building Nim isn’t hard, but it’s also not obvious what is going on. There are of course binary installers available too, but hey, we want to hack!

Here Comes Nim!

| Comments

I just posted an article comparing some silly benchmarks between Cog Smalltalk and LuaJIT2. Now… let’s take a look at one of the latest “Cool Kids” on the language front, Nimrod - or as it has been renamed - Nim.

Cog vs LuaJIT2

| Comments

In the open source Smalltalk community we have a pretty fast VM these days - its called Cog and is written by the highly gifted and experienced Eliot Miranda who also happens to be a really nice guy! Cog is fast and its also still improving with some more developers joining recently.

Another very fast VM is LuaJIT2 for the Lua language (version 5.1), also written by a single individual with extraordinary programming talent - Mike Pall. LuaJIT2 is often mentioned as the fastest dynamically typed language (or VM) and even though Lua is similar to Smalltalk (well, its actually very similar to Javascript) its also clearly a different beast with other characteristics. If you start looking at the world of game development - then Lua appears everywhere.