Read more about it here: https://nim-lang.org/blog/2025/02/05/nim-222.html
(Yeah yeah, missed opportunity to release Nim 2.2.2 on Feb 2nd :))
Tools update:
nightlies now support macOS arm64 https://github.com/nim-lang/nightlies/releases/tag/latest-devel choosenim 0.8.12 now supports macOS arm64 nightlies https://github.com/nim-lang/choosenim/releases/tag/v0.8.12
The following code compiled with Nim 2.2.0, whereas with Nim 2.2.2 it fails to compile with the following error:
$ nim r test.nim
/private/tmp/test.nim(13, 28) Error: type mismatch: got 'Agent[Uninitialized]' for 'agent' but expected 'Agent[Initialized]'
# test.nim
type
Status = enum
Uninitialized, Initialized
Agent[S: static Status] = object
name: string
proc newAgent(name: string): Agent[Uninitialized] =
return Agent[Uninitialized](name: name)
proc initialized(agent: Agent[Uninitialized]): Agent[Initialized] =
return Agent[Initialized](agent)
when isMainModule:
let uninit = newAgent("hello")
let inited = initialized(uninit)
assert uninit is Agent[Uninitialized]
assert inited is Agent[Initialized]
BTW, current choosenim seems to have an issue with architecture detection on Windows. At least it forced me to update my mingw installation.
I don't see why the code should work as it is.
There is an explicit conversion? Agent[Initialized](agent) ..
A small change in behaviour broke my tests. Contrast 2.2.0 vs. 2.2.2:
~/projects/scratch/nim $ cat floatstr.nim
var n = 1.0e-7
echo n
~/projects/scratch/nim $ choosenim 2.2.0
Switched to Nim 2.2.0
~/projects/scratch/nim $ nim r floatstr.nim
Hint: used config file '/home/vinay/.choosenim/toolchains/nim-2.2.0/config/nim.cfg' [Conf]
Hint: used config file '/home/vinay/.choosenim/toolchains/nim-2.2.0/config/config.nims' [Conf]
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
10257 lines; 0.022s; 10.559MiB peakmem; proj: /disk2/vinay/projects/scratch/nim/floatstr.nim; out: /home/vinay/.cache/nim/floatstr_d/floatstr_A6ED112E1540897079E28E2F80BADC1C2CD2A0AA [SuccessX]
Hint: /home/vinay/.cache/nim/floatstr_d/floatstr_A6ED112E1540897079E28E2F80BADC1C2CD2A0AA [Exec]
1e-07
~/projects/scratch/nim $ choosenim 2.2.2
Switched to Nim 2.2.2
~/projects/scratch/nim $ nim r floatstr.nim
Hint: used config file '/home/vinay/.choosenim/toolchains/nim-2.2.2/config/nim.cfg' [Conf]
Hint: used config file '/home/vinay/.choosenim/toolchains/nim-2.2.2/config/config.nims' [Conf]
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
10538 lines; 0.022s; 10.535MiB peakmem; proj: /disk2/vinay/projects/scratch/nim/floatstr.nim; out: /home/vinay/.cache/nim/floatstr_d/floatstr_2F8DB5FEED6F7372589CA58678AC58B46DA95FC9 [SuccessX]
Hint: /home/vinay/.cache/nim/floatstr_d/floatstr_2F8DB5FEED6F7372589CA58678AC58B46DA95FC9 [Exec]
0.0000001
Now, is this considered a regression? The old behaviour has been like that since 1.6 at least, perhaps even earlier, -d:nimPreviewFloatRoundtrip becomes the default. system.addFloat and system.$ now can produce string representations of floating point numbers that are minimal in size and possess round-trip and correct rounding guarantees (via the Dragonbox algorithm). Use -d:nimLegacySprintf to emulate old behaviors.