4.0 KiB
v1.0 - 2019-09-23
Changes affecting backwards compatibility
-
The switch
-d:nimBinaryStdFilesdoes not exist anymore. Instead stdin/stdout/stderr are binary files again. This change only affects Windows. -
On Windows console applications the code-page is set at program startup to UTF-8. Use the new switch
-d:nimDontSetUtf8CodePageto disable this feature. -
The language definition and compiler are now stricter about
gensym'ed symbols in hygienic templates. See the section in the manual for further details. Use the compiler switch--oldgensym:onfor a transition period.
Breaking changes in the standard library
- We removed
unicode.Rune16without any deprecation period as the name was wrong (see the RFC for details) and we didn't find any usage of it in the wild. If you still need it, add this piece of code to your project:
type
Rune16* = distinct int16
exportcnow uses C instead of C++ mangling withnim cpp, matching behavior ofimportc, see #10578. Use the newexportcppto mangle as C++ when usingnim cpp.
Breaking changes in the compiler
- A bug allowing
intto be implicitly converted to range types of smaller size (e.grange[0'i8..10'i8]) has been fixed.
Library additions
encodings.getCurrentEncodingnow distinguishes between the console's encoding and the OS's encoding. This distinction is only meaningful on Windows.- Added
system.getOsFileHandlewhich is usually more useful thansystem.getFileHandle. This distinction is only meaningful on Windows. - Added a
json.parseJsonFragmentsiterator that can be used to speedup JSON processing substantially when there are JSON fragments separated by whitespace.
Library changes
-
Added
os.delEnvandnimscript.delEnv. (#11466) -
Enabled Oid usage in hashtables. (#11472)
-
Added
unsafeColumnAtprocs, that return unsafe cstring from InstantRow. (#11647) -
Make public
Sha1DigestandSha1Statetypes andnewSha1State,updateandfinalizeprocedures fromsha1module. (#11694) -
Added the
std/monotimesmodule which implements monotonic timestamps. -
Consistent error handling of two
execoverloads. (#10967) -
Officially the following modules now have an unstable API:
- std/varints
- core/allocators
- core/hotcodereloading
- asyncstreams
- base64
- browsers
- collections/rtarrays
- collections/sharedlist
- collections/sharedtable
- concurrency/atomics
- concurrency/cpuload
- concurrency/threadpool
- coro
- endians
- httpcore
- parsesql
- pathnorm
- reservedmem
- typetraits
Every other stdlib module is API stable with respect to version 1.
Language additions
- Inline iterators returning
lent Ttypes are now supported, similarly to iterators returningvar T:
iterator myitems[T](x: openarray[T]): lent T
iterator mypairs[T](x: openarray[T]): tuple[idx: int, val: lent T]
- Added an
importjspragma that can now be used instead ofimportcppandimportcto import symbols from JavaScript.importjsfor routines always takes a "pattern" for maximum flexibility.
Language changes
uint64is now finally a regular ordinal type. This meanshigh(uint64)compiles and yields the correct value.
Tool changes
- The Nim compiler now does not recompile the Nim project via
nim c -rif no dependent Nim file changed. This feature can be overridden by the--forceBuildcommand line option. - The Nim compiler now warns about unused module imports. You can use a
top level
{.used.}pragma in the module that you want to be importable without producing this warning. - The "testament" testing tool's name was changed
from
testertotestamentand is generally available as a tool to run Nim tests automatically.
Compiler changes
- VM can now cast integer type arbitrarily. (#11459)