diff --git a/jekyll/_posts/2021-09-30-version-160-released.md b/jekyll/_posts/2021-09-30-version-160-released.md new file mode 100644 index 000000000..33978074c --- /dev/null +++ b/jekyll/_posts/2021-09-30-version-160-released.md @@ -0,0 +1,417 @@ +--- +title: "Version 1.6.0 released" +author: The Nim Team +--- + +Nim version 1.6 is now officially released! + +A year in the making, 1.6 is the latest stable release and by far the largest yet. +We're proud of what we --- the core team and dedicated volunteers --- have accomplished +with this milestone: +* 1667 PRs merged (1760 commits) +* 893 issues closed +* 15 new stdlib modules +* new features in more than 40 stdlib modules, including major improvements to 10 commonly used modules +* documentation and minor improvements to 170 modules, including 312 new runnable examples +* 280 new nimble packages + +Nim made its first entry in TIOBE index in 2017 at position 129, +last year it entered the top-100, and in the last 2 months the top-50 ([link](https://forum.nim-lang.org/t/8297)). +We hope this release will reinforce this trend, building on Nim's core strengths: +a practical, compiled systems programming language offering C-like performance +and portability, Python-like syntax, Lisp-like flexibility, strong C, C++, JS, +Python interop, and best-in-class metaprogramming. + +This release includes improvements in the following areas: +* new language features (`iterable[T]`, user-defined literals, private imports, strict effects, + dot-like operators, block arguments with optional parameters) +* new compiler features (`nim --eval:cmd`, custom nimscript extensions, customizable compiler messages) +* major improvements to `--gc:arc` and `--gc:orc` +* correctness and performance of integer and float parsing and rendering in all backends +* significant improvements in error messages, showing useful context +* documentation generation logic and documentation, in particular `runnableExamples` now works in more contexts +* JS, VM and nimscript backend are more consistent with C backend, allowing more + modules to work with those backends, including the imports from `std/prelude`; + the test suite now standardizes on testing stdlib modules on each major backend (C, JS, VM) +* support for Apple silicon/M1, 32-bit RISC-V, armv8l, CROSSOS, improved support for NodeJS backend +* major improvements to the following modules: `system`, `math`, `random`, `json`, `jsonutils`, `os`, + `typetraits`, `wrapnils`, `lists`, `hashes` including performance improvements +* deprecated a number of error prone or redundant features + + +## Why use Nim? + +* One language to rule them all: from [shell scripting](https://nim-lang.org/docs/nims.html) to + [web frontend and backend](https://github.com/nim-lang/nimforum), + [scientific computing](https://github.com/SciNim), + [deep learning](https://github.com/mratsim/Arraymancer), + [blockchain client](https://github.com/status-im), + [gamedev](https://github.com/ftsf/nico), + [embedded](https://github.com/EmbeddedNim), see also some + [companies using Nim](https://github.com/nim-lang/Nim/wiki/Organizations-using-Nim). +* Concise and readable: `echo "hello world"` is a 1-liner (5 lines in C, C++, Go, Java). +* Small binaries: `echo "hello world"` generates a 73K binary (or 5K with further options) + (Go: 2MB, Rust: 377K, C++: 56K) [1]. +* Fast compile times: a full compiler rebuild takes ~12s (Rust: 15min, gcc: 30min+, clang: 1hr+, Go: 90s) [2]. +* Native performance: see [Web Frameworks Benchmark](https://web-frameworks-benchmark.netlify.app/result), + [ray tracing](https://nim-lang.org/blog/2020/06/30/ray-tracing-in-nim.html), + [primes](https://github.com/PlummersSoftwareLLC/Primes). +* No need for makefiles, cmake, configure or other build scripts, thanks to compile-time + function evaluation (CTFE) and dependency tracking [3]. +* Target any platform with a C compiler: + [Android and iOS](https://github.com/pragmagic/godot-nim#made-with-godot-nim), + [embedded systems](https://github.com/elcritch/nesper), + [micro-controllers](https://forum.nim-lang.org/t/7731), + [WASM](https://forum.nim-lang.org/t/4779), Nintendo Switch, + [Game Boy Advance](https://forum.nim-lang.org/t/8375). +* Zero-overhead interop lets you reuse code in C, C++ (including templates, + [C++ STL](https://clonkk.github.io/nim-cppstl/cppstl.html)), JS, Objective-C, + Python (via [nimpy](https://github.com/yglukhov/nimpy)). +* Built-in [documentation generator](https://nim-lang.github.io/Nim/system.html) + that understands Nim code and runnable examples that stay in sync. + +Last but not least, macros let you manipulate/generate code at compile time instead +of relying on code generators, enabling writing DSLs and language extensions in user code. +Typical examples include implementing Python-like +[f-strings](https://nim-lang.github.io/Nim/strformat.html), +[optional chaining](https://nim-lang.github.io/Nim/wrapnils.html), +[command line generators](https://github.com/c-blake/cligen), +React-like [Single Page Apps](https://github.com/karaxnim/karax), +[protobuf serialization and binding generators](https://github.com/PMunch/protobuf-nim). + + +# Installing Nim 1.6 + +We recommend everyone to upgrade to 1.6: + + +## New users + +Check out if your package manager already ships version 1.6 or +install it as described [here](https://nim-lang.org/install.html). + + +## Existing users + +If you have installed a previous version of Nim using `choosenim`, +getting Nim 1.6 is as easy as: + +```bash +choosenim update self +choosenim update stable +``` + +If you don't have `choosenim`, you can follow the same +[install link](https://nim-lang.org/install.html) as above. + + +## Building from source + +```bash +git clone https://github.com/nim-lang/Nim +cd Nim +sh build_all.sh +``` +The last command can be re-run after pulling new commits. +Note that the `csources` repo used was changed to `csources_v1`, the new setup +is designed to be forward and backward compatible. + + +## Building from a CI setup + +We now have bash APIs to (re-)build Nim from source which hide implementation details, +for example: `. ci/funs.sh && nimBuildCsourcesIfNeeded`. +This can be useful for CI when alternatives (using nightly builds or a Docker image) are not suitable; +in fact all the existing CI pipelines have been refactored to use this, see +[#17815](https://github.com/nim-lang/Nim/pull/17815). + + +# Contributors to Nim 1.6 + +Many thanks to our recurring and new +[contributors](https://github.com/nim-lang/Nim/graphs/contributors?from=2020-10-16&to=2021-09-25&type=c). +Nim is a community driven collaborative effort that welcomes all contributions, big or small. + + +# Backward compatibility and preview flags + +Starting with this release, we've introduced preview flags of the form `-d:nimPreviewX` +(e.g. `-d:nimPreviewFloatRoundtrip`), which allow users to opt-in to new stdlib/compiler behavior +that will likely become the default in the next or a future release. +These staging flags aim to minimize backward compatibility issues. + +We also introduced opt-out flags of the form `-d:nimLegacyX`, e.g. `-d:nimLegacyCopyFile`, +for cases where the default was changed to the new behavior. +For a transition period, these flags can be used to get the old behavior. + +Here's the list of these flags introduced in this release, refer to the text below for explanations: +- `-d:nimLegacyCopyFile` +- `-d:nimLegacyJsRound` +- `-d:nimLegacyJsonutilsHoleyEnum` +- `-d:nimLegacyMacrosCollapseSymChoice` +- `-d:nimLegacyParseQueryStrict` +- `-d:nimLegacyRandomInitRand` +- `-d:nimLegacyReprWithNewline` +- `-d:nimLegacySigpipeHandler` +- `-d:nimLegacyTypeMismatch` +- `-d:nimPreviewDotLikeOps` +- `-d:nimPreviewFloatRoundtrip` + + +# Major new features + +With so many new features, pinpointing the most salient ones is a subjective exercise, +but here are a select few: + + +## `iterable[T]` + +The `iterable[T]` type class was added to match called iterators, +which solves a number of long-standing issues related to iterators. +Example: + +```nim +iterator iota(n: int): int = + for i in 0..