Aug 31, 2021

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 to the problem as part-blindness and recommends the user to use a good type system. In this article I’ll discuss the ideas behind boolean and part blindness and muse on the concept of computing and error checking with options.

Read More
Jun 24, 2021

Mark the date and time: Saturday, June 26th 2021 at 11am UTC.

NimConf 2021 is an online conference and it will take place on June 26th. It will be streamed for free and it doesn’t require any travelling - you will be able to participate from your home, without any travel and accommodation expenses.

May 15, 2021

It’s a bit too early for an official plan/RFC, so instead I’m writing this down here. Once Nim can bootstrap via –gc:orc we should make this the default GC as it works best with destructor based custom memory management. Since this is all based on the “new runtime” which isn’t ABI compatible this deserves the 2.0 version. This should also be our next LTS version.

We should take the opportunity and clean up the standard library – system.nim is too big and I don’t see why io.nim and assert.nim should be part of it. I also long for better versions of json.nim, os.nim, strutils.nim etc.

Read More
Feb 24, 2021

The Nim team is happy to announce the double patch release of versions 1.2.10 and 1.4.4.

The crucial bugfix that demanded these releases is the rework of the SSL certificate handling; it is now performed correctly and also enabled on Windows. The 1.0.x line is not affected simply because 1.0 does not check SSL certificates at all. Please upgrade to either 1.2.10 or 1.4.4 immediately.

Jan 27, 2021

I will be starting a monthly blog post for community showcase entitled “This Month with Nim”.

This will be a method for developers in the Nim community to publish a small part of a blog post showing off what Nim is capable of and what people are working on. A brief example of what a post might look like is below.

This book gives an introduction into design and creation of graphical user interfaces using the GTK widget tool kit and the Nim programming language. The book has its focus on the Linux operating system (OS). While the Nim programming language does support all mayor operating systems, GTK has it main emphasis on the Linux OS. Windows and macOS are supported by GTK, but without true native look and feel. Android and iOS is not supported by GTK, but there is some early experimental support for the Librem mobile devices manufactured by the Purism company. As GTK is compact and has a modular design, it can be also used on devices with restricted resources like the Raspberry Pi family. While GTK is generally not used to create web applications, it may be possible to run GTK applications locally in a web browser by using the broadway GTK backend.

Read More
Jan 2, 2021

c2nim is preliminary meant to translate C header files. Because of this, the preprocessor is part of the parser. For example:

  #define abc 123
  #define xyz 789

Is translated into:

    abc* = 123
    xyz* = 789

c2nim is meant to translate fragments of C code and thus does not follow include files. c2nim cannot parse all of Ansi C and many constructs cannot be represented in Nim: for example duff’s device cannot be translated to Nim.

Dec 30, 2020

A lot has happened in the Nim world in 2020: two new major releases, two new memory managements strategies (ARC and ORC), the first Nim conference, and much more.

We’ll try to cover the most important bits chronologically in the following sections.

Dec 22, 2020

Greetings fellow Nim adventurers! Below you will find 16 handy Nim tips & tricks I came across while developing a medium-sized GUI program this year, Gridmonger (and related libraries). Some of them are about less known or undocumented Nim features or standard library functions, a few are workarounds for some rough edges of the language, and there’s also a handful of useful techniques I read about in forums or have invented on my own.

All tips are for Nim 1.4.2 and beyond, and most are applicable to the C backend. I hope you’ll find something useful here that will make your time with Nim more enjoyable and productive!

Read More
Dec 8, 2020

Version 1.4 ships with the so-called ORC memory management algorithm. ORC is the existing ARC algorithm (first shipped in version 1.2) plus a cycle collector. That’s also where the name comes from – the “O” stands for a cycle and “RC” stands for “reference counting”, which is the algorithm’s foundation.

The cycle collector is based on the pretty well known “trial deletion” algorithm by Lins and others. I won’t describe here how this algorithm works – you can read the paper for a good description.

As usual, I couldn’t resist the temptation to improve the algorithm and add more optimizations: The Nim compiler analyses the involved types and only if it is potentially cyclic, code is produced that calls into the cycle collector. This type analysis can be helped out by annotating a type as acyclic. For example, this is how a binary tree could be modeled:

  Node {.acyclic.} = ref object
    kids: array[2, Node]
    data: string

Unfortunately, the overhead of the cycle collector can be measurable in practice. This annotation can be crucial in order to get ORC’s performance close to ARC’s.

An innovation in ORC’s design is that cyclic root candidates can be registered and unregistered in constant time O(1). The consequence is that at runtime we exploit the fact that data in Nim is rarely cyclic.

Read More
Oct 16, 2020

We are very proud to announce Nim version 1.4 after six months of continuous development! Other than version 1.0, this is probably the biggest Nim release yet and we’re very excited to release it!

It contains exactly 900 new commits which have not already been backported to our previous versions. There are several new features and standard library additions compared to 1.2. We tried to keep breaking changes to a minimum, but some bugfixes weren’t possible without making those necessary changes, and we feel that our users will benefit from them.

We would recommend to all of our users to upgrade and use version 1.4.

Read More

Updates from the Nim programming language.

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula.

Created on Oct 16, 2020
By @root