* move formatfloat out of system * fixes doc * Update changelog.md * careless * fixes * deprecate system/formatfloat * better handling
7.3 KiB
v1.8.x - yyyy-mm-dd
Changes affecting backward compatibility
-
addris now available for all addressable locations,unsafeAddris now deprecated and an alias foraddr. -
io,assertions,formatfloatare about to move out of thesystemmodule. You may instead importstd/syncio,std/assertionsandstd/formatfloat. The-d:nimPreviewSlimSystemoption makes these imports required. -
The
gc:v2option is removed. -
The
threads:onoption is now the default. -
Optional parameters in combination with
: bodysyntax (RFC #405) are now opt-in viaexperimental:flexibleOptionalParams. -
The
Math.truncpolyfill for targeting Internet Explorer was previously included in most JavaScript output files. Now, it is only included with-d:nimJsMathTruncPolyfill. 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. -
shallowCopyis removed for ARC/ORC. Usemovewhen possible or combine assignment andsinkfor optimization purposes. -
nimPreviewDotLikeOpsis going to be removed or deprecated. -
The
{.this.}pragma, deprecated since 0.19, has been removed. -
nilis no longer a valid value for distinct pointer types.
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.colPaleVioletRedandcolMediumPurplehave also been changed to match the CSS color standard. - Fixed
lists.SinglyLinkedListbeing broken after removing the last node (#19353). - The
md5module now works at compile time and in JavaScript. std/smtpsendsehlofirst. If the mail server does not understand, it sendsheloas a fallback.- Changed
mimedbto use anOrderedTableinstead ofOrderedTableRefto supportconsttables. strutils.findnow uses and defaults tolast = -1for whole string searches, making limiting it to just the first char (last = 0) valid.random.randnow works withOrdinals.
- Added ISO 8601 week date utilities in
times:- Added
IsoWeekRange, a range type for weeks in a week-based year. - Added
IsoYear, a distinct type for a week-based year in contrast to a regular year. - Added a
initDateTimeoverload to create a datetime from an ISO week date. - Added
getIsoWeekAndYearto get an ISO week number and week-based year from a datetime. - Added
getIsoWeeksInYearto return the number of weeks in a week-based year.
- Added
- Added
std/oserrorsfor OS error reporting. Addedstd/envvarsfor environment variables handling. - Added
sepparameter instd/urito specify the query separator. - Added bindings to
Array.shiftandqueueMicrotaskinjscorefor JavaScript targets. - Added
UppercaseLetters,LowercaseLetters,PunctuationChars,PrintableCharssets tostd/strutils.
- Deprecated
selfExefor Nimscript. - Deprecated
std/sums.
- Removed deprecated module
parseopt2. - Removed deprecated module
sharedstrings. - Removed deprecated module
dom_extensions. - Removed deprecated module
LockFreeHash. - Removed deprecated module
events. - 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/posix.CMSG_SPACEandstd/posix.CMSG_LENthat takes wrong argument types. - Removed deprecated
osproc.poDemon, symbol with typo.
Language changes
-
Tag tracking supports the definition of forbidden tags by the
.forbidspragma which can be used to disable certain effects in proc types. -
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". -
definednow accepts identifiers separated by dots, i.e.defined(a.b.c). In the command line, this is defined as-d:a.b.c. Older versions can use accents as indefined(`a.b.c`)to access such defines. -
Macro pragmas changes:
-
Templates now accept macro pragmas.
-
Macro pragmas for var/let/const sections have been redesigned in a way that works similarly to routine macro pragmas. The new behavior is documented in the experimental manual.
-
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
-
-
Redefining templates with the same signature implicitly was previously allowed to support certain macro code. A
{.redefine.}pragma has been added to make this work explicitly, and a warning is generated in the case where it is implicit. This behavior only applies to templates, redefinition is generally disallowed for other symbols.
Compiler 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".) -
Defines the
gcRefcsymbol which allows writing specific code for the refc GC. -
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. -
--styleCheck,--hintAsErrorand--warningAsErrornow only applies to the current package. -
The switch
--nimMainPrefix:prefixhas been added to add a prefix to the names ofNimMainand related functions produced on the backend. This prevents conflicts with other Nim static libraries.
Tool changes
- 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.