5.7 KiB
v0.20.0 - XX/XX/2018
Changes affecting backwards compatibility
-
The
isLower,isUpperfamily 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 oncharorRuneare not affected. -
strutils.editDistancehas been deprecated, useeditdistance.editDistanceoreditdistance.editDistanceAsciiinstead. -
The OpenMP parallel iterator `
||` now supports any#pragma omp directivesand 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
uncheckedpragma was removed, instead usesystem.UncheckedArray. -
The undocumented
#? strongSpacesparsing mode has been removed. -
The
notoperator is now always a unary operator, this means that code likeassert not isFalse(3)compiles.
Breaking changes in the standard library
-
osproc.execProcessnow also takes aworkingDirparameter. -
options.UnpackErroris no longer a ref type and inherits fromSystem.Defectinstead ofSystem.ValueError. -
nre's
RegexMatch.{captureBounds,captures}[]no longer returnOptionornil/"", respectivly. Use the newly addedn in p.capturesmethod to check if a group is captured, otherwise you'll recieve an exception. -
nre's
RegexMatch.{captureBounds,captures}.toTableno 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 ofnilstrings, this is the only way to indicate a missing match. Inside your loops, instead ofcapture == ""orcapture == nil, usecapture.isSometo check if a capture is present, andcapture.getto get its value. -
nre's
replace()no longer throwsValueErrorwhen the replacement string has missing captures. It instead throwsKeyErrorfor named captures, andIndexErrorfor un-named captures. This is consistant withRegexMatch.{captureBounds,captures}[]. -
splitFile now correctly handles edge cases, see #10047
Breaking changes in the compiler
- The compiler now implements the "generic symbol prepass" for
whenstatements 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 xis now illegal whenxis a function symbol.- Implicit imports via
--import: modulein a config file are now restricted to the main package.
Library additions
-
There is a new stdlib module
std/editdistanceas a replacement for the deprecatedstrutils.editDistance. -
There is a new stdlib module
std/wordwrapas a replacement for the deprecatedstrutils.wordwrap. -
Added
split,splitWhitespace,size,alignLeft,align,strip,repeatprocs and iterators tounicode.nim. -
Added
orforNimNodeinmacros. -
Added
system.typeoffor more control over howtypeexpressions can be deduced. -
Added
macros.isInstantiationOffor checking if the proc symbol is instantiation of generic proc symbol. -
Added the parameter
isSortedfor thesequtils.deduplicateproc. -
There is a new stdlib module
std/diffto compute the famous "diff" of two texts by line. -
Added
os.relativePath. -
Added
parseopt.remainingArgs. -
Added
os.getCurrentCompilerExe(implmented asgetAppFilenameat CT), can be used to retrive the currently executing compiler.
Library changes
-
The string output of
macros.lispReprproc has been tweaked slightly. ThedumpLispmacro in this module now outputs an indented proper Lisp, devoid of commas. -
In
strutilsempty strings now no longer matched as substrings anymore. -
Complex type is now generic and not a tuple anymore.
-
The
ospathsmodule is now deprecated, useosinstead. Note thatosis available in a NimScript environment but unsupported operations produce a compile-time error. -
The
parseoptmodule now supports a new flagallowWhitespaceAfterColon(default value: true) that can be set tofalsefor better Posix interoperability. (Bug #9619.) -
os.joinPathandos.normalizePathhandle edge cases like"a/b/../../.."differently.
Language additions
- Vm suport for float32<->int32 and float64<->int64 casts was added.
- There is a new pragma block
noSideEffectthat works like thegcsafepragma block. - added os.getCurrentProcessId()
- User defined pragmas are now allowed in the pragma blocks
- Pragma blocks are now longer eliminated from the typed AST tree to preserve pragmas for further analysis by macros
Language changes
- The standard extension for SCF (source code filters) files was changed from
.tmplto.nimf, it's more recognizable and allows tools like github to recognize it as Nim, see #9647. The previous extension will continue to work.
Tool changes
jsondocnow include amoduleDescriptionfield with the module description.jsondoc0shows comments as it's own objects as shown in the documentation.
Compiler changes
- The deprecated
fmodproc is now unavailable on the VM'.