Nim version 2.2.6 released

The Nim Team is happy to announce version 2.2.6, the third patch release for our stable release, Nim 2.2.

It comes six months after the 2.2.4 release and it contains 141 commits, bringing bugfixes and improvements.

If you’re still on Nim 1.6, take a look at the version 2.0 release article to see all the features you’re missing. If you’ve been using Nim 2.0, the version 2.2 release article shows the improvements available in Nim 2.2.

The Nim 2.2.6 changelog is available here.

Highlights

Exception handling combined with Nim’s async is more stable than ever before as the underlying closure iterator transformation has been rewritten.

The compiler is now smart enough to produce a move operation for return obj.field. Previously it performed a copy. Expect your code to run slightly faster due to this and other minor performance improvements.

Installing Nim 2.2.6

Check out if the package manager of your OS already ships version 2.2.6 or install it as described here.

If you have installed a previous version of Nim using choosenim, getting Nim 2.2.6 is as easy as:

$ choosenim update self
$ choosenim update stable

NOTE: We recommend you to install and use the latest version of choosenim, v.0.8.16, available in our choosenim repo.

Alternatively, you can download Nim 2.2.6 from our nightlies builds.

Bugfixes

  • Fixed “=destroy for non-var failed to compile when JS” (#24914)
  • Fixed “{.push raises: [].} doesn’t respect lexical scoping” (#23355)
  • Fixed “Pragma block disabling warning has effect beyond block” (#21975)
  • Fixed “missing < (less than), cmp for cstring” (#24941)
  • Fixed “[GC] Illegal storage access when collecting cycle” (#4851)
  • Fixed “Globals in proc with static params end up being re-initialized” (#24940)
  • Fixed “Constructor to global variable in converter generates illegal c code” (#4594)
  • Fixed “Compile-time regression from v2.2.4 to version-2-2/devel with global variable with unhandled exception: iterators.nim(254, 11) len(a) == L the length of the seq changed while iterating over it [AssertionDefect]” (#24981)
  • Fixed “SIGSEGV when raising Defect/doAssert” (#24974)
  • Fixed “Crash on marking destroy hook as .error” (#24996)
  • Fixed “hasCustomPragma stops working after typedesc is copied” (#23564)
  • Fixed “Asyncnet accept leaks socket on SSL error; Regression in devel” (#25023)
  • Fixed “SIGSEGV in closure iterator with try/except not at top level” (#21235)
  • Fixed “Regression from v2.2.4 to version-2-2/devel with closure iterator” (#25038)
  • Fixed “fixes #24997; {.global.} variable in recursive function” (#25016)
  • Fixed “concept param passed to varargs causes internal error: genTypeInfo(tyUserTypeClassInst) when JS backend” (#25043)
  • Fixed “Bad order of destruction” (#24719)
  • Fixed “Floats are not range checked” (#7179)
  • Fixed “typo in docs” (#25084)
  • Fixed “Regression from Nim v2.2.2 to v2.2.4/version-2-2/devel in nim cpp with compatible types not keeping L-valueness” (#25109)
  • Fixed “FieldDefect compiler crash when comparing pointers at compile time” (#25066)
  • Fixed “Slow compilation due to vmgen.sameConstant and memory allocations” (#25114)
  • Fixed “unhandled exception: field 'sym' is not accessible for type 'TNode' using 'kind = nkEmpty' [FieldDefect] with iterator-loop” (#25121)
  • Fixed “strutils.formatSize returns wrong values from large values close to int64.high” (#25125)
  • Fixed “Dereferencing result of cast in single expression triggers unnecessary copy” (#24093)
  • Fixed “internal error: '=destroy' operator not found for type NimNode returning NimNode” (#25120)
  • Fixed “requiresInit not checked for result if it has been used (2.2 regression)” (#25117)
  • Fixed “filterIt wrongly results in rvalue” (#25078)
  • Fixed “@ extremely slow for trivial types” (#25063)
  • Fixed “withValue for immut tab wrong chk cond” (#25162)
  • Fixed “Invalid C codegen refc with generic types containing gc memory” (#24844)
  • Fixed “SinglyLinkedList.remove broken / AssertionDefect” (#25173)
  • Fixed “error: ‘T2_’ undeclared and error: incompatible types when assigning to type ‘void *’” (#24361)
  • Fixed “Noncopyable base type ignored” (#24760)
  • Fixed “lent string generic field isn’t preserving its value” (#25127)
  • Fixed “cannot return lent expression from conditionals like case” (#23949)
  • Fixed “Error: internal error: proc has no result symbol” (#21476)
  • Fixed “Invalid codegen / dangling pointer for openArray escaping from block” (#24261)
  • Fixed “lib/system/iterators.nim(250, 14) Error: internal error: genArrayLen()” (#25167)
  • Fixed “Error: unhandled exception: field 'sym' is not accessible for type 'TNode'” (#21138)
  • Fixed “error: ‘pthread_mutex_t’ has no member named ‘abi’ in refc with reset/{.exportc.}” (#25205)
  • Fixed “Uninitialized variable usage in resize__system_u... in @psystem.nim.c in ORC” (#25204)
  • Fixed “VM error when passing object field ref to proc(var T): var T” (#25210)
  • Fixed “Closure environement wrongly marked as cyclic (orc)” (#25048)
  • Fixed “Infinite loop with anonymous iterator” (#25046)
  • Fixed “JS: cast[char](i) for i > 255 not truncate” (#25222)
  • Fixed “VM issue with globals and assignments” (#25208)
  • Fixed “Case object from compileTime proc unable to be passed as static param” (#25123)
  • Fixed “VM repr raises RangeDefect for long string under refc” (#25226)
  • Fixed “Broken assignment of union with bool inside variant object” (#25236)
  • Fixed “deques: Deque items behavior is not the same on 2.0.16 and 2.2.0” (#25240)
  • Fixed “nim doc uses doc comment from private field for public field” (#25027)
  • Fixed “Compiler internal error compiler/vmgen.nim(1771, 23) with static overload” (#25008)
  • Fixed “Wrong exception raised wrapped in finally in closure iterator; Regression in devel/version-2-2” (#25202)

The complete list of changes is available here.