openSUSE Reaches First-Class Support for Nim Language

14. Jul 2022 | David Anes and Douglas DeMaio | CC-BY-SA-3.0

openSUSE Reaches First-Class Support for Nim Language

openSUSE joins fellow open-source project Arch Linux in having up-to-date packages for the Nim Language and the statically typed, imperative programming language now has first-class Nim support in openSUSE.

The compiled programming language gives programmers runtime efficiency and combines successful concepts from mature languages like Python, Ada and Modula.

“Real software runs without an OS, but if yours needs one, choose one which offers first class Nim support. Like SUSE does.” , said Nim programming language creator Andreas Rumpf, when asked about openSUSE supporting up-to-date Nim from now on.

Rumpf created Nim back in 2005 and has recently published his book Mastering Nim covering each corner of this emerging programming language.

There are Nim packages built for x86-64, i586, ppc64le and ARM64 with openSUSE.

“Very excited to have the first Linux distribution announcing first-class support for Nim,” said Dominik Picheta, a Nim core developer and writer of the Nim in Action book. “Hope this opens the door for other distros to do the same.”

One of Nim strengths, besides the macro system and runtime efficiency, is its standard library, which is similar to other languages and covers most standard functionality; these include string handling and formatting, async code development, networking and even high-level language functionality (like the compiler itself) or NimScript, which is a subset of Nim specially built for scripting that can be embedded and executed at run-time.

Moreover, Nim comes with a wide range of tools included by default. The compiler allows the targeting of C, C++ and Javascript as its backend. There are a few tools included for easy development:

  • nim compiler
  • nimsuggest (support for language suggestions, autocompletion, error/issues detection, etc.)
  • nimgrep (a powerful grep alternative with built-in Nim support to find symbols and inspect Nim codebases).
  • nim-gdb wrapper (gdb support for Nim types)
  • nimble (package manager)

There is automated testing for openSUSE builds. Generally availability for Nim with openSUSE involves upstreaming broken tests for specific architectures along with the backporting and upstreaming of security patches.

Nim has a very interesting and vibrant ecosystem of packages for easy development on many fronts; from web development to systems programming and scientific to data processing, to name a few. It’s possible to develop extremely fast and parallelized applications using Weave, develop both frontend and backend web applications fully in Nim by using Karax or Jester and to perform heavy computational math-based operations with ArrayMancer. On the playful side, Nim can be used to develop high-performance 3D visualizations and game development with Godot by using Godot-Nim as a bridge.

Even if developers only want to support another language, Nim allows a rich ecosystem of foreign function interface (FFI) technologies to interact with other languages. Besides the native support to interact with C and C++ codebases, it is possible to use Nim to easily build Python modules by using NimPy.

Developers can play around with Nim at https://play.nim-lang.org/ and can learn a bit about it in five-minutes.

A taste of Nim

import strformat

type
  Person = object
    name*: string # Field is exported using `*`.
    age: Natural  # Natural type ensures the age is positive.

var people = [
  Person(name: "John", age: 45),
  Person(name: "Kate", age: 30)
]

for person in people:
  # Type-safe string interpolation.
  echo(fmt"{person.name} is {person.age} years old")

Useful Links

Share this post: