2 min read

Earlier this week, the Nim team announced the release of Nim 0.19 with many language changes, async improvements, and support for the latest Nimble 0.9.0.

Nim is a systems and applications programming language, which aims for better performance, portability, and expressiveness. It is a statically typed and compiled language which comes with unparalleled performance in an elegant package. Its common features include:

  • High-performance garbage-collection
  • Compiles to C, C++ or JavaScript
  • Runs on Windows, macOS, Linux

What’s new in Nim 0.19?

Language changes and additions

  • The nil state for strings/seqs is no more supported and their default value is changed to  “” / @[]. In the transition period you can use –nilseqs:on.
  • It is now invalid to access the binary zero terminator in Nim’s native strings, but internally it can still have the trailing zero to support zero-copy interoperability with cstring. In the transition period you can compile your code using the new –laxStrings:on switch.
  • Instead of being an all-or-nothing switch, experimental is now a pragma and a command line switch that can allow specific language extensions.
  • You can make dot calls combined with explicit generic instantiations using the syntax x.y[:z], which is converted as y[z](x) by the parser.
  • You can use func as an alias for proc {.noSideEffect.}.
  • Nim now supports for-loop macros to make for loops and iterators more flexible to use. This feature enables a Python-like generic enumerate implementation.
  • In order to implement pattern matching for certain types, case statements can be rewritten via macros.
  • Keyword arguments after the comma are supported in the command syntax.
  • Declaration of thread-local variables inside procs is now supported. This implies all the effects of the global pragma.
  • Nim supports the except clause in the export statement.

Async improvements

Nim’s async macro now works completely with exception handling. The use of await in a try statement is also supported.

Supports Nimble 0.9.0

This release comes with Nimble 0.9.0, which was released recently in August. This version contains a large number of fixes spread across 57 commits. One breaking change that you need to keep in mind is that any package that specifies a bin value in its .nimble file will no longer install any Nim source code files.

Breaking changes

  • The deprecated symbols in the standard library such as system.expr or the old type aliases starting with a T or P prefix have been removed.
  • SystemError is now renamed to CatchableError and is the new base class for any exception that is guaranteed to be catchable.

Read the full announcement on Nim’s official website.

Read Next

Rust as a Game Programming Language: Is it any good?

Java 11 is here with TLS 1.3, Unicode 11, and more updates

The 5 most popular programming languages in 2018