5.3 KiB
v1.8.x - yyyy-mm-dd
Changes affecting backward compatibility
-
The
Math.truncpolyfill for targeting Internet Explorer was previously emitted for every JavaScript output file except if the symbolnodejswas defined via-d:nodejs. Now, it is only emitted if the symbolnimJsMathTruncPolyfillis defined. If you are targeting Internet Explorer, you may choose to enable this option or define your ownMath.truncpolyfill using theemitpragma. Nim usesMath.truncfor the division and modulo operators for integers. -
Deprecated
std/sums. -
Optional parameters in combination with
: bodysyntax (RFC #405) are now opt-in viaexperimental:flexibleOptionalParams. -
std/sharedstringsmodule is removed. -
Constants
colors.colPaleVioletRedandcolors.colMediumPurplechanged to match the CSS color standard. -
addris now available for all addressable locations,unsafeAddris deprecated and becomes an alias foraddr. -
io is about to move out of system; use
-d:nimPreviewSlimSystemand importstd/syncio. -
The
gc:v2option is removed.
Standard library additions and changes
macros.parseExprandmacros.parseStmtnow accept an optional. filename argument for more informative errors.- Module
colorsexpanded with missing colors from the CSS color standard. - Fixed
lists.SinglyLinkedListbeing broken after removing the last node (#19353). md5now works at compile time and in JavaScript.std/smtpsendsehlofirst. If the mail server does not understand, it sendsheloas a fallback.- Changed mimedb to use an
OrderedTableinstead ofOrderedTableRef, to use it in a const. strutils.findnow use and default tolast=-1for whole string searches, making limiting it to just the first char (last=0) valid.
- Added
IsoWeekRange, a range type to represent the number of weeks in an ISO week-based year. - Added
IsoYear, a distinct int type to prevent bugs from confusing the week-based year and the regular year. - Added
initDateTimeintimesto create a datetime from a weekday, and ISO 8601 week number and week-based year. - Added
getIsoWeekAndYearintimesto get an ISO week number along with the corresponding ISO week-based year from a datetime. - Added
getIsoWeeksInYearintimesto return the number of weeks in an ISO week-based year. - Added
std/oserrorsfor OS error reporting. Addedstd/envvarsfor environment variables handling. - Added
sepparameter instd/urito specify the query separator. - Added
Array.shiftfor JavaScript targets. - Added
queueMicrotaskfor JavaScript targets.
- Deprecated
selfExefor Nimscript.
- Removed deprecated
oids.oidToString. - Removed define
nimExperimentalAsyncjsThenforstd/asyncjs.thenandstd/jsfetch. - Removed deprecated
jsre.testandjsre.toString. - Removed deprecated
math.c_frexp. - Removed deprecated
httpcore.`==`. - Removed deprecated
std/dom_extensions. - Removed deprecated
std/posix.CMSG_SPACEandstd/posix.CMSG_LENthat takes wrong argument types. - Removed deprecated
osproc.poDemon, symbol with typo.
Language changes
-
Pragma macros on type definitions can now return
nnkTypeSectionnodes as well asnnkTypeDef, allowing multiple type definitions to be injected in place of the original type definition.import macros macro multiply(amount: static int, s: untyped): untyped = let name = $s[0].basename result = newNimNode(nnkTypeSection) for i in 1 .. amount: result.add(newTree(nnkTypeDef, ident(name & $i), s[1], s[2])) type Foo = object Bar {.multiply: 3.} = object x, y, z: int Baz = object # becomes type Foo = object Bar1 = object x, y, z: int Bar2 = object x, y, z: int Bar3 = object x, y, z: int Baz = object -
Case statement macros are no longer experimental, meaning you no longer need to enable the experimental switch
caseStmtMacrosto use them. -
Full command syntax and block arguments i.e.
foo a, b: care now allowed for the right-hand side of type definitions in type sections. Previously they would error with "invalid indentation".
Compiler changes
nimcan now compile version 1.4.0 as follows:nim c --lib:lib --stylecheck:off compiler/nim, without requiring-d:nimVersion140which is now a noop.
Tool changes
-
The
gcswitch has been renamed tomm("memory management") in order to reflect the reality better. (Nim moved away from all techniques based on "tracing".) -
Nim now supports Nimble version 0.14 which added support for lock-files. This is done by a simple configuration change setting that you can do yourself too. In
$nim/config/nim.cfgreplacepkgsbypkgs2. -
There is a new switch
--nimMainPrefix:prefixto influence theNimMainthat the compiler produces. This is particularly useful for generating static libraries.