Learning: Nim

1 month ago
1

Streamed on 2025-01-02 (https://www.twitch.tv/thediscouragerofhesitancy)

Today we took a look at the Nim programming language. It has some Python-like syntax while being strongly typed like C. It transpiles to C, then compiles that with a C compiler. This lead to the first issue we had.

We started as usual by looking through the documentation. Then we installed the compiler (simple download, unzip, add to PATH procedure). It almost worked out of the box. But instead it was picking up the wrong C compiler. With a bit of digging we found a way to point it at the right one and we were off to the horseraces. To try it out there was no need to install. There is a website to test drive your nim code, so that is a nice touch.

I picked the Advent of Code for 2021 to try out Nim. It feels more Python-like than I thought it would. There are a few complaints I have, but mostly it is workable. It wasn't too difficult to grind through 4 days of AOC puzzles. Then we took a brief look at the C output of Nim. It does not bear much of a resemblance to the input code. It was an interesting exercise.

Loading comments...