-
The
isLower
,isUpper
family of procs in strutils/unicode operating on strings have been deprecated since it was unclear what these do. Note that the much more useful procs that operator onchar
orRune
are not affected. -
strutils.editDistance
has been deprecated, useeditdistance.editDistance
oreditdistance.editDistanceAscii
instead. -
The OpenMP parallel iterator `
||
` now supports any#pragma omp directives
and not just#pragma omp parallel for
. See OpenMP documentation.The default annotation is
parallel for
, if you used OpenMP without annotation the change is transparent, if you used annotations you will have to prefix your previous annotations withparallel for
. -
The
unchecked
pragma was removed, instead usesystem.UncheckedArray
. -
The undocumented
#? strongSpaces
parsing mode has been removed. -
The
not
operator is now always a unary operator, this means that code likeassert not isFalse(3)
compiles. -
getImpl
on avar
orlet
symbol will now return the fullIdentDefs
tree from the symbol declaration instead of just the initializer portion.
-
osproc.execProcess
now also takes aworkingDir
parameter. -
options.UnpackError
is no longer a ref type and inherits fromsystem.Defect
instead ofsystem.ValueError
. -
system.ValueError
now inherits fromsystem.CatchableError
instead ofsystem.Defect
. -
The procs
parseutils.parseBiggsetInt
,parseutils.parseInt
,parseutils.parseBiggestUInt
andparseutils.parseUInt
now raise aValueError
when the parsed integer is outside of the valid range. Previously they sometimes raised aOverflowError
and sometimes returned0
. -
streams.StreamObject
now restricts its fields to only raisesystem.Defect
,system.IOError
andsystem.OSError
. This change only affects custom stream implementations. -
nre's
RegexMatch.{captureBounds,captures}[]
no longer returnOption
ornil
/""
, respectivly. Use the newly addedn in p.captures
method to check if a group is captured, otherwise you'll recieve an exception. -
nre's
RegexMatch.{captureBounds,captures}.toTable
no longer accept a default parameter. Instead uncaptured entries are left empty. UseTable.getOrDefault()
if you need defaults. -
nre's
RegexMatch.captures.{items,toSeq}
now returns anOption[string]
instead of astring
. With the removal ofnil
strings, this is the only way to indicate a missing match. Inside your loops, instead ofcapture == ""
orcapture == nil
, usecapture.isSome
to check if a capture is present, andcapture.get
to get its value. -
nre's
replace()
no longer throwsValueError
when the replacement string has missing captures. It instead throwsKeyError
for named captures, andIndexError
for un-named captures. This is consistant withRegexMatch.{captureBounds,captures}[]
. -
splitFile now correctly handles edge cases, see #10047
-
isNil
is no longer false for undefined in the JavaScript backend: now it's true for both nil and undefined. UseisNull
orisUndefined
if you need exact equallity:isNil
is consistent with===
,isNull
andisUndefined
with==
. -
several deprecated modules were removed:
ssl
,matchers
,httpserver
,unsigned
,actors
,parseurl
-
two poorly documented and not used modules (
subexes
,scgi
) were moved to graveyard (they are available as Nimble packages)
- The compiler now implements the "generic symbol prepass" for
when
statements in generics, see bug #8603. This means that code like this does not compile anymore:
proc enumToString*(enums: openArray[enum]): string =
# typo: 'e' instead 'enums'
when e.low.ord >= 0 and e.high.ord < 256:
result = newString(enums.len)
else:
result = newString(enums.len * 2)
discard x
is now illegal whenx
is a function symbol.- Implicit imports via
--import: module
in a config file are now restricted to the main package.
-
There is a new stdlib module
std/editdistance
as a replacement for the deprecatedstrutils.editDistance
. -
There is a new stdlib module
std/wordwrap
as a replacement for the deprecatedstrutils.wordwrap
. -
Added
split
,splitWhitespace
,size
,alignLeft
,align
,strip
,repeat
procs and iterators tounicode.nim
. -
Added
or
forNimNode
inmacros
. -
Added
system.typeof
for more control over howtype
expressions can be deduced. -
Added
macros.isInstantiationOf
for checking if the proc symbol is instantiation of generic proc symbol. -
Added the parameter
isSorted
for thesequtils.deduplicate
proc. -
There is a new stdlib module
std/diff
to compute the famous "diff" of two texts by line. -
Added
os.relativePath
. -
Added
parseopt.remainingArgs
. -
Added
os.getCurrentCompilerExe
(implmented asgetAppFilename
at CT), can be used to retrieve the currently executing compiler. -
Added
xmltree.toXmlAttributes
. -
Added
std/sums
module for fast summation functions. -
Added
Rusage
,getrusage
,wait4
to posix interface.
-
The string output of
macros.lispRepr
proc has been tweaked slightly. ThedumpLisp
macro in this module now outputs an indented proper Lisp, devoid of commas. -
In
strutils
empty strings now no longer matched as substrings anymore. -
Complex type is now generic and not a tuple anymore.
-
The
ospaths
module is now deprecated, useos
instead. Note thatos
is available in a NimScript environment but unsupported operations produce a compile-time error. -
The
parseopt
module now supports a new flagallowWhitespaceAfterColon
(default value: true) that can be set tofalse
for better Posix interoperability. (Bug #9619.) -
os.joinPath
andos.normalizePath
handle edge cases like"a/b/../../.."
differently. -
securehash
is moved tolib/deprecated
- Vm support for float32<->int32 and float64<->int64 casts was added.
- There is a new pragma block
noSideEffect
that works like thegcsafe
pragma block. - added os.getCurrentProcessId()
- User defined pragmas are now allowed in the pragma blocks
- Pragma blocks are no longer eliminated from the typed AST tree to preserve pragmas for further analysis by macros
- Custom pragmas are now supported for
var
andlet
symbols.
- The standard extension for SCF (source code filters) files was changed from
.tmpl
to.nimf
, it's more recognizable and allows tools like github to recognize it as Nim, see #9647. The previous extension will continue to work. - Pragma syntax is now consistent. Previous syntax where type pragmas did not follow the type name is now deprecated. Also pragma before generic parameter list is deprecated to be consistent with how pragmas are used with a proc. See #8514 and #1872 for further details.
jsondoc
now include amoduleDescription
field with the module description.jsondoc0
shows comments as it's own objects as shown in the documentation.nimpretty
: --backup now defaults tooff
instead ofon
and the flag was un-documented; usegit
instead of relying on backup files.
- The deprecated
fmod
proc is now unavailable on the VM'.