- Allows using with `--experimental:strictFuncs`
- `{.cast(noSideEffect).}:` inside the proc was required to mutate
`s.len`, same as used in `newSeqImpl`.
- Removed now unnecessary `noSideEffect` casts in `system.nim`
-
Closes #24811
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
(cherry picked from commit ecdcffed4b)
2.8 KiB
v2.x.x - yyyy-mm-dd
Changes affecting backward compatibility
-
-d:nimPreviewFloatRoundtripbecomes the default.system.addFloatandsystem.$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:nimLegacySprintfto emulate old behaviors. -
The
defaultparameter oftables.getOrDefaulthas been renamed todefto avoid conflicts withsystem.default, so named argument usage for this parameter likegetOrDefault(..., default = ...)will have to be changed. -
With
-d:nimPreviewCheckedClose, theclosefunction in thestd/synciomodule now raises an IO exception in case of an error. -
Unknown warnings and hints now gives warnings
warnUnknownNotesinstead of errors. -
With
-d:nimPreviewAsmSemSymbol, backticked symbols are type checked in theasm/emitstatements.
Standard library additions and changes
setutils.symmetricDifferencealong with its operator versionsetutils.`-+-`and in-place versionsetutils.togglehave been added to more efficiently calculate the symmetric difference of bitsets.strutils.multiReplaceoverload for character set replacements in a single pass. Useful for string sanitation. Follows existing multiReplace semantics.
-
std/mathThe^symbol now supports floating-point as exponent in addition to the Natural type. -
system.substrimplementation now usescopymem(wrapped Cmemcpy) for copying data, if available at compilation. -
system.newStringUninitis now considered free of side-effects allowing it to be used with--experimental:strictFuncs.
Language changes
-
An experimental option
--experimental:typeBoundOpshas been added that implements the RFC https://github.com/nim-lang/RFCs/issues/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")] # 34See the experimental manual for more information.