Hide
Scraps
RSS

Tips and tricks with implicit return in Nim

1st November 2019

One feature in Nim that it shares with several other languages, especially functional ones, is implicit return of values. This is one of those small features that might just seem like a way to avoid writing return everywhere. But in fact it can be used for much more than that! So what is implicit return? In Nim we have three ways to return a value from a procedure, you have the explicit way with return,…


Welcome to a brief explanation of history

17th September 2019

History, as you might know, is of course the GNU History Library. It is a utility that allows us to read, repeat, and track the commands we run in our shells. Apparently a lot of people feel really strongly about history, so I’ve added some quotes in this article to underline how nice of a feature this is.

A library is the delivery room for the birth of ideas, a place where history comes to life.

  • Norman…


Metaprogramming and read- and maintainability in Nim

4th June 2019

One thing I've mentioned about metaprogramming in Nim, both in posts on this site and in talks, is that metaprogramming in Nim can enhance read- and maintainability. Opponents of metaprogramming would probably sneer at that and remark that it's quite the opposite. And sure, metaprogramming is a powerful tool, and with any sufficiently powerful tool you have to be careful. The same way a chainsaw can take your leg off if you're not careful, a…


Meta-programming in Nim - FOSDEM talk companion post

5th February 2019

This article is intended as a companion to the lightning talk I held at FOSDEM 2019. If you haven't seen the talk yet the official recording from the FOSDEM site is embeded below (if you want you can also grab the slides for this presentation on that site).


Optional value handling in Nim

6th August 2018

I recently had a look at a functional language named Toccata which amongst other things does away with booleans. While this migth seem utterly insane it's not an entirely new concept and proponents of such ideas will warn you of the perils of boolean blindness. This refers to the fact that booleans themselves carry no information apart from their value. But as others have pointed out this is true of all values and the linked article instead refers…