mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 01:44:37 +00:00
2.8 KiB
2.8 KiB
v0.18.0 - dd/mm/yyyy
Changes affecting backwards compatibility
- Removed basic2d/basic3d out of the stdlib and into Nimble packages.
These packages deprecated however, use the
glm,arraymancer,neoor another package. - Arrays of char cannot be converted to
cstringanymore, pointers to arrays of char can! This means$for arrays can finally exist insystem.nimand do the right thing. echonow works with strings that contain\0(the binary zero is not shown) andnilstrings are equal to empty strings.- JSON: Deprecated
getBVal,getFNum, andgetNumin favour togetBool,getFloat,getBiggestInt. AlsogetIntprocedure was added. reExtendedis no longer default for thereconstructor in theremodule.- The overloading rules changed slightly so that constrained generics are preferred over unconstrained generics. (Bug #6526)
- It is now possible to forward declare object types so that mutually recursive types can be created across module boundaries. See package level objects for more information.
- The unary
<is now deprecated, for.. <use..<for other usages use thepredproc. - We changed how array accesses "from backwards" like
a[^1]ora[0..^1]are implemented. These are now implemented purely insystem.nimwithout compiler support. There is a new "heterogenous" slice typesystem.HSlicethat takes 2 generic parameters which can beBackwardsIndexindices.BackwardsIndexis produced bysystem.^. This means if you overload[]or[]=you need to ensure they also work withsystem.BackwardsIndex(if applicable for the accessors). modand bitwiseanddo not producerangesubtypes anymore. This turned out to be more harmful than helpful and the language is simpler without this special typing rule.- Added
algorithm.rotateLeft. rationals.toRationalnow uses an algorithm based on continued fractions. This means its results are more precise and it can't run into an infinite loop anymore.- Added
typetraits.$as an alias fortypetraits.name. os.getEnvnow takes an optionaldefaultparameter that tellsgetEnvwhat to return if the environment variable does not exist.- Removed PDCurses wrapper from the stdlib and published it as a separate Nimble package.
- The parsing rules of
ifexpressions were changed so that multiple statements are allowed in the branches. We found few code examples that now fail because of this change, but here is one:
.. code-block:: nim
t[ti] = if exp_negative: '-' else: '+'; inc(ti)
This now needs to be written as:
.. code-block:: nim
t[ti] = (if exp_negative: '-' else: '+'); inc(ti)