Nim 2 Released
Written by Alex Denham   
Thursday, 03 August 2023

There's a new release of Nim, the systems programming language, with improvements including ORC memory management as a default.

Nim, formerly called Nimrod, is strongly typed and has first class functions. It is object-oriented, but with composition preferred over inheritance. Nim compiles to C as its default, but can be used with different compiler back-ends to produce JavaScript, C++, or Objective-C.

nim

The list of improvements to Nim 2 start with the inclusion of ORC memory managemen by default. ORC was added experimentally in an earlier release of Nim, and was created by combining the existing ARC (Automatic Reference Counting (ARC)) algorithm with a cycle collector.

Describing the technique on nim-lang.github.io, Andreas Rumpf says that reference cycles are handled by a cycle collection mechanism based on "trial deletion". He explains that entire subgraphs are moved between threads, and that the Nim compiler also aggressively optimizes away RC ops and exploits move semantics.

Other improvements to this release include better tuple unpacking. Tuple unpacking for variables is now treated as syntax sugar that directly expands into multiple assignments. In addition, tuple unpacking for variables can now be nested.

There's an improved type inference called top-down inference that has been implemented for a variety of basic cases, and tag tracking now supports the definition of forbidden tags. 

Several library modules have been overhauled, including the os module, where some of its features are available under a new interface that introduces a Path abstraction.

Elsewhere, support for default values for objects means that fields can now have default values inside an object definition.

The developers have added a new experimental switch to guard agains errors introduced by Nim's default initialization rule. When the switch is enabled, variables have to have been given a value explicitly before they can be used.

Nim has also got improved error messages for type mismatch.

Nim 2.0 is available now from the Nim website.

nim

More Information

Nim 2 On GitHub

Nim Language Site

Related Articles

Nim Reaches 1.0

Nim Reaches Release Candidate Stage 

Nim Improves Async  

Nim 0.15

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


JavaZone - The Conference We Missed
25/10/2024

Amongst the many Java related conferences, this one flew under the radar. A real shame because it had many great sessions.
JavaZone might not be that famous internationally, but it still is the bi [ ... ]



Wasmer 5 Adds iOS Support
12/11/2024

The Wasmer team has released Wasmer 5.0. The WebAssembly runtime adds experimental support for more back ends including V8, Wasmi and WAMR. It also now has iOS support, and upgraded compilers includin [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info