-
-d:nimPreviewFloatRoundtrip
becomes the default.system.addFloat
andsystem.$
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. -
The
default
parameter oftables.getOrDefault
has been renamed todef
to avoid conflicts withsystem.default
, so named argument usage for this parameter likegetOrDefault(..., default = ...)
will have to be changed. -
With
-d:nimPreviewCheckedClose
, theclose
function in thestd/syncio
module now raises an IO exception in case of an error.
setutils.symmetricDifference
along with its operator versionsetutils.`-+-`
and in-place versionsetutils.toggle
have been added to more efficiently calculate the symmetric difference of bitsets.
std/math
The^
symbol now supports floating-point as exponent in addition to the Natural type.
-
An experimental option
--experimental:typeBoundOps
has been added that implements the RFC nim-lang/RFCs#380. This makes the behavior of interfaces likehash
,$
,==
etc. more reliable for nominal types across indirect/restricted imports.# objs.nim import std/hashes type Obj* = object x*, y*: int z*: string # to be ignored for equality proc `==`*(a, b: Obj): bool = a.x == b.x and a.y == b.y proc hash*(a: Obj): Hash = $!(hash(a.x) &! hash(a.y))
# main.nim {.experimental: "typeBoundOps".} from objs import Obj # objs.hash, objs.`==` not imported import std/tables var t: Table[Obj, int] t[Obj(x: 3, y: 4, z: "debug")] = 34 echo t[Obj(x: 3, y: 4, z: "ignored")] # 34
See the experimental manual for more information.