New version of the Nim programming language 0.20

Took place system programming language release Nim 0.20.0. The language uses static typing and is built with Pascal, C++, Python, and Lisp in mind. Nim source code is compiled into a C, C++, or JavaScript representation. Subsequently, the resulting C/C++ code is compiled into an executable file using any available compiler (clang, gcc, icc, Visual C++), which allows you to achieve performance close to C, if you do not take into account the cost of running the garbage collector. Similar to Python, Nim uses indentation as block separators. Metaprogramming tools and capabilities for creating domain-specific languages ​​(DSLs) are supported. Project code supplied under the MIT license.

The release of Nim 0.20 can be seen as a release candidate for the first stable 1.0 release, including several compatability-breaking changes necessary to form the first stable branch that commits the state of the language. Version 1.0 is touted as a stable, long-term support release that will be guaranteed to maintain backward compatibility in the stabilized part of the language. Separately, an experimental mode will also be available in the compiler, in which new features that may break backward compatibility will be developed.

Of the changes proposed in Nim 0.20, we can highlight:

  • "Not" is now always a unary operator, i.e. expressions like "assert(not a)" are now invalid and only "assert not a" is allowed;
  • Hard checks for converting integers and real numbers at compile time are enabled, i.e. the expression "const b = uint16(-1)" will now result in an error, since -1 cannot be converted to an unsigned integer type;
  • Unpacking of tuples for constants and loop variables is provided.
    For example, assignments like 'const (d, e) = (7, "eight")' and "for (x, y) in f" can now be used;

  • Provided default initialization of hashes and tables. For example, after declaring "var s: HashSet[int]" you can immediately execute "s.incl(5)", which used to lead to an error;
  • Improved the information content of errors for problems related to the "case" operator and array index out of bounds;
  • It is forbidden to change the table length during iteration.

Source: opennet.ru

Add a comment