Nim 2.2.0

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).

Tags programming-language compiler type-safe c cpp js
License MITL
State stable

Recent Releases

2.2.022 Jan 2025 02:37 major bugfix: Many long-standing compiler bugs with generics, typedesc and static types have been fixed in this release, effectively making these features stable. In particular, arbitrary expressions for types and values in generic types are now largely functional when they only worked in specific cases before. The release has a focus on bugfixes in general, with many other issues fixed across the board. This release continues with the improvements regarding C++ interop: - noInit can be used in types and fields to disable member initializers in the C++ backend. - C++ custom constructors initializers. - member can be used to attach a procedure to a C++ type. - Inside a C++ constructor, result can be used to access the created object rather than this. The JS backend now supports lambda lifting for closures and closure iterators. Methods now support implementations based on a VTable by using --experimental:vtables. Methods are then confined to the same module where their type has been defined. Tuple unpacking got a bit more powerful: - Tuple unpacking assignment now supports using underscores to discard values. var a, c: int (a, _, c) = (1, 2, 3) - Tuple unpacking variable declarations now support type annotations, but only for the entire tuple. let (a, b): (int, int) = (1, 2) let (a, (b, c)): (byte, (float, cstring)) = (1, (2, "abc")) An experimental switch --experimental:openSym has been added to deal with issues with symbol captures inside generic routines templates. For macro authors, this adds a new node kind nnkOpenSym that may need to be handled differently (similar to nnkOpenSymChoice). See the full changelog for details. Nim 2.2.0 ships with Nimble 0.16.1, which brings a SAT solver as an opt-in option.