Index RSS

NimConf 2020

I watched some videos from NimConf today and wanted to share some impressions I've got (and my opinion of Nim at the moment).

First things first, what is Nim? Nim is a promising new language that combines the high level nature of python (and its significant whitespace) with the performance and systems programming capabilities of C. It is compiled, not to bytecode or machine code, but to C. This means that a Nim installation requires a working C compiler. This also means that Nim has a very easy way to bind to C libraries.

Nim allows manual memory management, but also has multiple implementations of garbage collection that can be used. They are even usable with soft real-time requirements: you can select an upper bound for the maximum time the gc may take.

I have no real experience with Nim myself (yet), but I am currently reading the well-written book "Nim in Action". Finding that a online conference with multiple interesting talks was taking place right now therefore was a pleasant surprise. I did however only watch a few yet, so I cannot say anything about the rest of them. I wholeheartedly recommend you to watch them yourself!

You can find the videos either on the conference webpage or directly via Youtube.

conf.nim-lang.org
Youtube playlist

An intro to Nim for the uninitiated (Dominik Picheta)

The first talk I watched (after the opening) was by the author of the book I mentioned before. I liked it: It is (naturally) not a replacement for the book itself, but gave a good overview over the way the syntax works and over some more advanced features like generics (which by the way seem to be very simple in Nim and not advanced in the "academic ivory-tower" - contrary to what some Go users seem to believe).

I saw nothing I didn't like in the talk. Yes, some parts of the language are not perfect in my eyes, but these were of mere aesthetic nature and not functional show stoppers.

Making games quickly in Nim with Nico (Jez Impbox)

The second talk was a short introduction to Nico, a gaming library for Nim that is inspired by Pico8 (hence the name). The presenter created a little memory (card matching) game in a fast-paced yet easy to follow fashion. Writing the game looked very easy, using simple library callbacks for rendering or updating the game state.

A highlight of the talk was that the game could trivially be recompiled for the web as a javascript game without any code changes. If full-stack web applications are your thing, Nim seems to deliver (at least you can use it for frontend and backend).

I liked this talk very much and have a mind to try something with Nico in the future.

Game Boy Advance Development in Nim (Jeremy Clarke)

The next talk I watched also was about game development, but this time also satisfied my desire for Nintendo console development. The GBA was programmed at a low level, its hardware was accessed via memory mapped registers. It is however advanced (no pun intended) enough to be programmed with high level languages like C, using a library named TONC.

The presenter showed how to access the memory mapped registers via the volatile keyword from C and how to do it from Nim, either directly or via a very simple binding to the C definition. He improved the binding with some syntactic sugar that made setting and removing single bits simpler. By using Nim macros, he managed to also optimize setting multiple bits to a single read and write on the register. Behind the scenes, all work is done on a temporary variable before its value is written back to the register, but the developer neither has to know or care.

He also introduced two libraries of him, Natu and Trick. Natu is used for writing the game itself, while Trick can be used to implement tools for asset manipulation.

I also liked this talk a lot. It proofed that Nim can be used in very restricted environments and still improve over writing plain C. It also demonstrated that you have to refrain from quite a lot - neither was he using a garbage collector for the game, nor could he use most of the standard library. In that way, Nim shows that it is flexible, but cannot perform actual miracles.

Fidget: Let's rethink UI development with Nim (Andre von Houck)

The final talk I watched today presented a interesting and seemingly very nice way to program UI applications. Fidget is a library that uses exports from Figma and allows to use it in a straight-forward way in the actual code that either produced a native application that renders the UI via OpenGL (no electron - yeah!), or a web application like in the Nico talk.

The presenter stressed that Fidget code is simple: No callback hell, no (visible) futures, no nonsense, just straight code with loops and conditions. He compared Fidget to the way he wrote QBasic - something I can relate to very much.

This talk I found taxing, because the presenter appeared to be a very dynamic and extroverted character. Which is one of the reasons why I had no energy left to watch further talks. But I still think that Fidget looks amazing and would very much like it to succeed and become something I could use for my UI needs.

Closing words

This was my first real impression of what is cooking in the Nim community. I believe I will keep an eye on it from now on. Its just too bad that the Nim blog does not seem to have an RSS feed.

Nim blog