====
News
====
2016-XX-XX Version 0.13.1 released
==================================
Changes affecting backwards compatibility
-----------------------------------------
- ``--out`` and ``--nimcache`` command line arguments are now relative to
current directory. Previously they were relative to project directory.
- The json module now stores the name/value pairs in objects internally as a
hash table of type ``fields*: Table[string, JsonNode]`` instead of a
sequence. This means that order is no longer preserved. When using the
``table.mpairs`` iterator only the returned values can be modified, no
longer the keys.
- The deprecated Nim shebang notation ``#!`` was removed from the language. Use ``#?`` instead.
- The ``using`` statement now means something completely different. You can use the
new experimental ``this`` pragma to achieve a similar effect to what the old ``using`` statement tried to achieve.
- Typeless parameters have been removed from the language since it would
clash with ``using``.
- Procedures in ``mersenne.nim`` (Mersenne Twister implementation) no longer
accept and produce ``int`` values which have platform-dependent size -
they use ``uint32`` instead.
- The ``strutils.unindent`` procedure has been rewritten. Its parameters now
match the parameters of ``strutils.indent``. See issue [#4037](https://github.com/nim-lang/Nim/issues/4037)
for more details.
- The ``matchers`` module has been deprecated. See issue [#2446](https://github.com/nim-lang/Nim/issues/2446)
for more details.
- The ``json.[]`` no longer returns ``nil`` when a key is not found. Instead it
raises a ``KeyError`` exception. You can compile with the ``-d:nimJsonGet``
flag to get a list of usages of ``[]``, as well as to restore the operator's
previous behaviour.
- When using ``useMalloc``, an additional header containing the size of the
allocation will be allocated, to support zeroing memory on realloc as expected
by the language. With this change, ``alloc`` and ``dealloc`` are no longer
aliases for ``malloc`` and ``free`` - use ``c_malloc`` and ``c_free`` if
you need that.
- The ``json.%`` operator is now overloaded for ``object``, ``ref object`` and
``openarray[T]``.
Library Additions
-----------------
- The rlocks module has been added providing reentrant lock synchronization
primitive.
- A generic "sink operator" written as ``&=`` has been added to the ``system`` and the ``net`` modules.
- Added ``strscans`` module that implements a ``scanf`` for easy input extraction.
- Added a version of ``parseutils.parseUntil`` that can deal with a string ``until`` token. The other
versions are for ``char`` and ``set[char]``.
Compiler Additions
------------------
- Added a new ``--noCppExceptions`` switch that allows to use default exception
handling (no ``throw`` or ``try``/``catch`` generated) when compiling to C++
code.
Language Additions
------------------
- Nim now supports a ``.this`` pragma for more notational convenience.
- Nim now supports a different ``using`` statement for more convenience.
- Nim now supports ``partial`` object declarations to mitigate the problems
that arise when types are mutually dependent and yet should be kept in
different modules.
- ``include`` statements are not restricted to top level statements anymore.
2016-01-27 Nim in Action is now available!
==========================================
.. raw::html
We are proud to announce that *Nim in Action*, a book about the Nim programming
language, is now available!
The book is available at this URL:
`https://www.manning.com/books/nim-in-action `_
The first three chapters are available for download
as an eBook through Manning's Early Access program. You can download a free
sample of the book containing the first chapter as well!
*Nim in Action* is currently being written and is expected to be completed by
Summer 2016. If you purchase the eBook you will start receiving new chapters
as they become available. You can also purchase the printed book together with
the eBook for a slightly higher price.
If you do read the book, even if it's just the first chapter, then please share
any comments, suggestions and questions on the
`Nim forum `_ or in
Manning's own `Author Online forum! `_
2016-01-18 Version 0.13.0 released
==================================
Once again we are proud to announce the latest release of the Nim compiler
and related tools. This release comes just 3 months after the last
release!
A new version of Nimble which depends on this release, has also been
released. See `this `_ forum thread for
more information about the Nimble release.
This release of Nim includes over 116 bug fixes, many of which are related
to closures. The lambda lifting algorithm in the compiler has been completely
rewritten, and some changes have been made to the semantics of closures in
Nim as a result. These changes may affect backwards compatibility and are all
described in the section below.
With this release, we are one step closer to Nim version 1.0.
The 1.0 release will be a big milestone for Nim, because after that version
is released there will be no more breaking changes made to the language
or the standard library.
That being said, the next release will likely be Nim 0.14. It will focus on
improvements to the GC and concurrency. We will in particular be looking at
ways to add multi-core support to async await. Standard library improvements
are also on our roadmap but may not make it for Nim 0.14.
As always you can download the latest version of Nim from the
`download `_ page.
Happy coding!
Changes affecting backwards compatibility
-----------------------------------------
- ``macros.newLit`` for ``bool`` now produces false/true symbols which
actually work with the bool datatype.
- When compiling to JS: ``Node``, ``NodeType`` and ``Document`` are no longer
defined. Use the types defined in ``dom.nim`` instead.
- The check ``x is iterator`` (used for instance in concepts) was always a
weird special case (you could not use ``x is proc``) and was removed from
the language.
- Top level routines cannot have the calling convention ``closure``
anymore.
- The ``redis`` module has been moved out of the standard library. It can
now be installed via Nimble and is located here:
https://github.com/nim-lang/redis
- ``math.RunningStat`` and its associated procs have been moved from
the ``math`` module to a new ``stats`` module.
Syntax changes
~~~~~~~~~~~~~~
The parser now considers leading whitespace in front of operators
to determine if an operator is used in prefix or infix position.
This means that finally ``echo $foo`` is parsed as people expect,
which is as ``echo($foo)``. It used to be parsed as ``(echo) $ (foo)``.
``echo $ foo`` continues to be parsed as ``(echo) $ (foo)``.
This also means that ``-1`` is always parsed as prefix operator so
code like ``0..kArraySize div 2 -1`` needs to be changed to
``0..kArraySize div 2 - 1``.
This release also adds multi-line comments to Nim. The syntax for them is:
``#[ comment here ]#``. For more details read the section of
the `manual `_.
Iterator changes
~~~~~~~~~~~~~~~~
Implicit return type inference for iterators has been removed from the language. The following used to work:
.. code-block:: nim
iterator it =
yield 7
This was a strange special case and has been removed. Now you need to write it like so which is consistent with procs:
.. code-block:: nim
iterator it: auto =
yield 7
Closure changes
~~~~~~~~~~~~~~~
The semantics of closures changed: Capturing variables that are in loops do not produce a new environment. Nim closures behave like JavaScript closures now.
The following used to work as the environment creation used to be attached to the loop body:
.. code-block:: nim
proc outer =
var s: seq[proc(): int {.closure.}] = @[]
for i in 0 ..< 30:
let ii = i
s.add(proc(): int = return ii*ii)
This behaviour has changed in 0.13.0 and now needs to be written as:
.. code-block:: nim
proc outer =
var s: seq[proc(): int {.closure.}] = @[]
for i in 0 ..< 30:
(proc () =
let ii = i
s.add(proc(): int = return ii*ii))()
The reason is that environment creations are now only performed once
per proc call. This change is subtle and unfortunate, but:
1. Affects almost no code out there.
2. Is easier to implement and we are at a point in Nim's development process where simple+stable wins over perfect-in-theory+unstable-in-practice.
3. Implies programmers are more in control of where memory is allocated which is beneficial for a systems programming language.
Bugfixes
--------
The list below has been generated based on the commits in Nim's git
repository. As such it lists only the issues which have been closed
via a commit, for a full list see
`this link on Github `_.
- Fixed "Generic arguments cannot be used in templates (raising undeclared identifier)"
(`#3498 `_)
- Fixed "multimethods: Error: internal error: cgmeth.genConv"
(`#3550 `_)
- Fixed "nimscript - SIGSEGV in except block"
(`#3546 `_)
- Fixed "Bool literals in macros do not work."
(`#3541 `_)
- Fixed "Docs: nativesocket.html - 404"
(`#3582 `_)
- Fixed ""not nil" return types never trigger an error or warning"
(`#2285 `_)
- Fixed "No warning or error is raised even if not nil is specified "
(`#3222 `_)
- Fixed "Incorrect fsmonitor add() filter logic"
(`#3611 `_)
- Fixed ""nimble install nimsuggest" failed"
(`#3622 `_)
- Fixed "compile time `excl ` cause SIGSEGV"
(`#3639 `_)
- Fixed "Unable to echo unsigned ints at compile-time"
(`#2514 `_)
- Fixed "Nested closure iterator produces internal error"
(`#1725 `_)
- Fixed "C Error on walkDirRec closure"
(`#3636 `_)
- Fixed "Error in generated c code"
(`#3201 `_)
- Fixed "C Compile-time error with generic proc type."
(`#2659 `_)
- Fixed "ICE dereferencing array pointer"
(`#2240 `_)
- Fixed "Lambda lifting crash"
(`#2007 `_)
- Fixed "Can't reference outer variables from a closure in an iterator"
(`#2604 `_)
- Fixed "M&S collector breaks with nested for loops."
(`#603 `_)
- Fixed "Regression: bad C codegen"
(`#3723 `_)
- Fixed "JS backend - handle bool type in case statement"
(`#3722 `_)
- Fixed "linenoise compilation with cpp"
(`#3720 `_)
- Fixed "(???,???) duplicate case label"
(`#3665 `_)
- Fixed "linenoise compilation with cpp"
(`#3720 `_)
- Fixed "Update list of backward incompatibilities for Nim 0.12.0 in the main site"
(`#3689 `_)
- Fixed "Can't compile nimble with latest devel - codegen bug"
(`#3730 `_)
2016-01-18 Andreas Rumpf's talk at OSCON Amsterdam
==================================================
In case you have missed it, here is Andreas' Nim: An Overview talk at
OSCON Amsterdam.
.. raw:: html
2015-10-27 Version 0.12.0 released
==================================
The Nim community of developers is proud to announce the new version of the
Nim compiler. This has been a long time coming as the last release has been
made over 5 months ago!
This release includes some changes which affect backwards compatibility,
one major change is that now the hash table ``[]`` operators now raise a
``KeyError`` exception when the key does not exist.
Some of the more exciting new features include: the ability to unpack tuples
in any assignment context, the introduction of `NimScript `_,
and improvements to the type inference of lambdas.
There are of course many many many bug fixes included with this release.
We are getting closer and closer to a 1.0 release and are hoping that only
a few 0.x releases will be necessary before we are happy to release version 1.0.
As always you can download the latest version of Nim from the
`download `_ page.
For a more detailed list of changes look below. Some of the upcoming breaking
changes are also documented in this forum
`thread `_.
Changes affecting backwards compatibility
-----------------------------------------
- The regular expression modules, ``re`` and ``nre`` now depend on version
8.36 of PCRE. If you have an older version you may see a message similar
to ``could not import: pcre_free_study`` output when you start your
program. See `this issue `_
for more information.
- ``tables.[]``, ``strtabs.[]``, ``critbits.[]`` **now raise**
the ``KeyError`` **exception when the key does not exist**! Use the
new ``getOrDefault`` instead to get the old behaviour. Compile all your
code with ``-d:nimTableGet`` to get a listing of where your code
uses ``[]``!
- The ``rawsockets`` module has been renamed to ``nativesockets`` to avoid
confusion with TCP/IP raw sockets, so ``newNativeSocket`` should be used
instead of ``newRawSocket``.
- The ``miliseconds`` property of ``times.TimeInterval`` is now ``milliseconds``.
Code accessing that property is deprecated and code using ``miliseconds``
during object initialization or as a named parameter of ``initInterval()``
will need to be updated.
- ``std.logging`` functions no longer do formatting and semantically treat
their arguments just like ``echo`` does. Affected functions: ``log``,
``debug``, ``info``, ``warn``, ``error``, ``fatal``. Custom subtypes of
``Logger`` also need to be adjusted accordingly.
- Floating point numbers can now look like ``2d`` (float64)
and ``2f`` (float32) which means imports like ``import scene/2d/sprite``
do not work anymore. Instead quotes have to be
used: ``import "scene/2d/sprite"``. The former code never was valid Nim.
- The Windows API wrapper (``windows.nim``) is now not part of the official
distribution anymore. Instead use the ``oldwinapi`` Nimble package.
- There is now a clear distinction between ``--os:standalone``
and ``--gc:none``. So if you use ``--os:standalone`` ensure you also use
``--gc:none``. ``--os:standalone`` without ``--gc:none`` is now a version
that doesn't depend on any OS but includes the GC. However this version
is currently untested!
- All procedures which construct a ``Socket``/``AsyncSocket`` now need to
specify the socket domain, type and protocol. The param name
``typ: SockType`` (in ``newSocket``/``newAsyncSocket`` procs) was also
renamed to ``sockType``. The param ``af`` in the ``connect`` procs was
removed. This affects ``asyncnet``, ``asyncdispatch``, ``net``, and
``rawsockets``.
- ``varargs[typed]`` and ``varargs[untyped]`` have been refined and now work
as expected. However ``varargs[untyped]`` is not an alias anymore for
``varargs[expr]``. So if your code breaks for ``varargs[untyped]``, use
``varargs[expr]`` instead. The same applies to ``varargs[typed]`` vs
``varargs[stmt]``.
- ``sequtils.delete`` doesn't take confusing default arguments anymore.
- ``system.free`` was an error-prone alias to ``system.dealloc`` and has
been removed.
- ``macros.high`` never worked and the manual says ``high`` cannot be
overloaded, so we removed it with no deprecation cycle.
- To use the ``parallel`` statement you now have to
use the ``--experimental`` mode.
- Toplevel procs of calling convention ``closure`` never worked reliably
and are now deprecated and will be removed from the language. Instead you
have to insert type conversions
like ``(proc (a, b: int) {.closure.})(myToplevelProc)`` if necessary.
- The modules ``libffi``, ``sdl``, ``windows``, ``zipfiles``, ``libzip``,
``zlib``, ``zzip``, ``dialogs``, ``expat``, ``graphics``, ``libcurl``,
``sphinx`` have been moved out of the stdlib and are Nimble packages now.
- The constant fights between 32 and 64 bit DLLs on Windows have been put to
an end: The standard distribution now ships with 32 and 64 bit versions
of all the DLLs the standard library needs. This means that the following
DLLs are now split into 32 and 64 versions:
* ``pcre.dll``: Split into ``pcre32.dll`` and ``pcre64.dll``.
* ``pdcurses.dll``: Split into ``pdcurses32.dll`` and ``pdcurses64.dll``.
* ``sqlite3.dll``: Split into ``sqlite3_32.dll`` and ``sqlite3_64.dll``.
* ``ssleay32.dll``: Split into ``ssleay32.dll`` and ``ssleay64.dll``.
* ``libeay32.dll``: Split into ``libeay32.dll`` and ``libeay64.dll``.
Compile with ``-d:nimOldDLLs`` to make the stdlib use the old DLL names.
- Nim VM now treats objects as ``nkObjConstr`` nodes, and not ``nkPar`` nodes
as it was previously. Macros that generate ``nkPar`` nodes when object is
expected are likely to break. Macros that expect ``nkPar`` nodes to which
objects are passed are likely to break as well.
- Base methods now need to be annotated with the ``base`` pragma. This makes
multi methods less error-prone to use with the effect system.
- Nim's parser directive ``#!`` is now ``#?`` in order to produce no conflicts
with Unix's ``#!``.
- An implicit return type for an iterator is now deprecated. Use ``auto`` if
you want more type inference.
- The type ``auto`` is now a "multi-bind" metatype, so the following compiles:
.. code-block:: nim
proc f(x, y: auto): auto =
result = $x & y
echo f(0, "abc")
- The ``ftpclient`` module is now deprecated in favour of the
``asyncftpclient`` module.
- In sequtils.nim renamed ``repeat`` function to ``cycle`` (concatenating
a sequence by itself the given times), and also introduced ``repeat``,
which repeats an element the given times.
- The function ``map`` is moved to sequtils.nim. The inplace ``map`` version
is renamed to ``apply``.
- The template ``mapIt`` now doesn't require the result's type parameter.
Also the inplace ``mapIt`` is renamed to ``apply``.
- The compiler is now stricter with what is allowed as a case object
discriminator. The following code used to compile but was not supported
completely and so now fails:
.. code-block:: nim
type
DataType* {.pure.} = enum
Char = 1,
Int8 = 2,
Int16 = 3,
Int32 = 4,
Int64 = 5,
Float32 = 6,
Float64 = 7
DataSeq* = object
case kind* : DataType
of DataType.Char: charSeq* : seq[char]
of DataType.Int8: int8Seq* : seq[int8]
of DataType.Int16: int16Seq* : seq[int16]
of DataType.Int32: int32Seq* : seq[int32]
of DataType.Int64: int64Seq* : seq[int64]
of DataType.Float32: float32Seq* : seq[float32]
of DataType.Float64: float64Seq* : seq[float64]
length* : int
Library Additions
-----------------
- The nre module has been added, providing a better interface to PCRE than re.
- The ``expandSymlink`` proc has been added to the ``os`` module.
- The ``tailDir`` proc has been added to the ``os`` module.
- Define ``nimPinToCpu`` to make the ``threadpool`` use explicit thread
affinities. This can speed up or slow down the thread pool; it's up to you
to benchmark it.
- ``strutils.formatFloat`` and ``formatBiggestFloat`` do not depend on the C
locale anymore and now take an optional ``decimalSep = '.'`` parameter.
- Added ``unicode.lastRune``, ``unicode.graphemeLen``.
Compiler Additions
------------------
- The compiler now supports a new configuration system based on
`NimScript `_.
- The compiler finally considers symbol binding rules in templates and
generics for overloaded ``[]``, ``[]=``, ``{}``, ``{}=`` operators
(issue `#2599 `_).
- The compiler now supports a `bitsize pragma `_
for constructing bitfields.
- Added a new ``--reportConceptFailures`` switch for better debugging of
concept related type mismatches. This can also be used to debug
``system.compiles`` failures.
Language Additions
------------------
- ``system.unsafeAddr`` can be used to access the address of a ``let``
variable or parameter for C interoperability. Since technically this
makes parameters and ``let`` variables mutable, it is considered even more
unsafe than the ordinary ``addr`` builtin.
- Added ``macros.getImpl`` that can be used to access the implementation of
a routine or a constant. This allows for example for user-defined inlining
of function calls.
- Tuple unpacking finally works in a non-var/let context: ``(x, y) = f()``
is allowed. Note that this doesn't declare ``x`` and ``y`` variables, for
this ``let (x, y) = f()`` still needs to be used.
- ``when nimvm`` can now be used for compiletime versions of some code
sections. Click `here `_ for details.
- Usage of the type ``NimNode`` in a proc now implicitly annotates the proc
with ``.compileTime``. This means generics work much better for ``NimNode``.
Bugfixes
--------
- Fixed "Compiler internal error on iterator it(T: typedesc[Base]) called with it(Child), where Child = object of Base"
(`#2662 `_)
- Fixed "repr() misses base object field in 2nd level derived object"
(`#2749 `_)
- Fixed "nimsuggest doesn't work more than once on the non-main file"
(`#2694 `_)
- Fixed "JS Codegen. Passing arguments by var in certain cases leads to invalid JS."
(`#2798 `_)
- Fixed ""check" proc in unittest.nim prevents the propagation of changes to var parameters."
(`#964 `_)
- Fixed "Excessive letters in integer literals are not an error"
(`#2523 `_)
- Fixed "Unicode dashes as "lisp'ish" alternative to hump and snake notation"
(`#2811 `_)
- Fixed "Bad error message when trying to construct an object incorrectly"
(`#2584 `_)
- Fixed "Determination of GC safety of globals is broken "
(`#2854 `_)
- Fixed "v2 gc crashes compiler"
(`#2687 `_)
- Fixed "Compile error using object in const array"
(`#2774 `_)
- Fixed "httpclient async requests with method httpPOST isn't sending Content-Length header"
(`#2884 `_)
- Fixed "Streams module not working with JS backend"
(`#2148 `_)
- Fixed "Sign of certain short constants is wrong"
(`#1179 `_)
- Fixed "Symlinks to directories reported as symlinks to files"
(`#1985 `_)
- Fixed "64-bit literals broken on x86"
(`#2909 `_)
- Fixed "import broken for certain names"
(`#2904 `_)
- Fixed "Invalid UTF-8 strings in JavaScript"
(`#2917 `_)
- Fixed "[JS][Codegen] Initialising object doesn't create unmentioned fields."
(`#2617 `_)
- Fixed "Table returned from proc computed at compile time is missing keys:"
(`#2297 `_)
- Fixed "Clarify copyright status for some files"
(`#2949 `_)
- Fixed "math.nim: trigonometry: radians to degrees conversion"
(`#2881 `_)
- Fixed "xoring unsigned integers yields RangeError in certain conditions"
(`#2979 `_)
- Fixed "Directly checking equality between procs"
(`#2985 `_)
- Fixed "Compiler crashed, but there have to be meaningful error message"
(`#2974 `_)
- Fixed "repr is broken"
(`#2992 `_)
- Fixed "Ipv6 devel - add IPv6 support for asyncsockets, make AF_INET6 a default"
(`#2976 `_)
- Fixed "Compilation broken on windows"
(`#2996 `_)
- Fixed "'u64 literal conversion compiler error"
(`#2731 `_)
- Fixed "Importing 'impure' libraries while using threads causes segfaults"
(`#2672 `_)
- Fixed "Uncatched exception in async procedure on raise statement"
(`#3014 `_)
- Fixed "nim doc2 fails in Mac OS X due to system.nim (possibly related to #1898)"
(`#3005 `_)
- Fixed "IndexError when rebuilding Nim on iteration 2"
(`#3018 `_)
- Fixed "Assigning large const set to variable looses some information"
(`#2880 `_)
- Fixed "Inconsistent generics behavior"
(`#3022 `_)
- Fixed "Compiler breaks on float64 division"
(`#3028 `_)
- Fixed "Confusing error message comparing string to nil "
(`#2935 `_)
- Fixed "convert 64bit number to float on 32bit"
(`#1463 `_)
- Fixed "Type redefinition and construction will break nim check"
(`#3032 `_)
- Fixed "XmlParser fails on very large XML files without new lines"
(`#2429 `_)
- Fixed "Error parsing arguments with whitespaces"
(`#2874 `_)
- Fixed "Crash when missing one arg and used a named arg"
(`#2993 `_)
- Fixed "Wrong number of arguments in assert will break nim check"
(`#3044 `_)
- Fixed "Wrong const definition will break nim check"
(`#3041 `_)
- Fixed "Wrong set declaration will break nim check"
(`#3040 `_)
- Fixed "Compiler segfault (type section)"
(`#2540 `_)
- Fixed "Segmentation fault when compiling this code"
(`#3038 `_)
- Fixed "Kill nim i"
(`#2633 `_)
- Fixed "Nim check will break on wrong array declaration"
(`#3048 `_)
- Fixed "boolVal seems to be broken"
(`#3046 `_)
- Fixed "Nim check crashes on wrong set/array declaration inside ref object"
(`#3062 `_)
- Fixed "Nim check crashes on incorrect generic arg definition"
(`#3051 `_)
- Fixed "Nim check crashes on iterating nonexistent var"
(`#3053 `_)
- Fixed "Nim check crashes on wrong param set declaration + iteration"
(`#3054 `_)
- Fixed "Wrong sharing of static_t instantations"
(`#3112 `_)
- Fixed "Automatically generated proc conflicts with user-defined proc when .exportc.'ed"
(`#3134 `_)
- Fixed "getTypeInfo call crashes nim"
(`#3099 `_)
- Fixed "Array ptr dereference"
(`#2963 `_)
- Fixed "Internal error when `repr`-ing a type directly"
(`#3079 `_)
- Fixed "unknown type name 'TNimType' after importing typeinfo module"
(`#2841 `_)
- Fixed "Can export a template twice and from inside a block"
(`#1738 `_)
- Fixed "C Codegen: C Types are defined after their usage in certain cases"
(`#2823 `_)
- Fixed "s.high refers to the current seq instead of the old one"
(`#1832 `_)
- Fixed "Error while unmarshaling null values"
(`#3149 `_)
- Fixed "Inference of `static[T]` in sequences"
(`#3144 `_)
- Fixed "Argument named "closure" to proc inside template interfere with closure pragma"
(`#3171 `_)
- Fixed "Internal error with aliasing inside template"
(`#3158 `_)
- Fixed "Cardinality of sets prints unexpected value"
(`#3135 `_)
- Fixed "Nim crashes on const assignment from function returning var ref object"
(`#3103 `_)
- Fixed "`repr` cstring"
(`#3080 `_)
- Fixed "Nim check crashes on wrong enum declaration"
(`#3052 `_)
- Fixed "Compiler assertion when evaluating template with static[T]"
(`#1858 `_)
- Fixed "Erroneous overflow in iterators when compiler built with overflowChecks enabled"
(`#3140 `_)
- Fixed "Unicode dashes as "lisp'ish" alternative to hump and snake notation"
(`#2811 `_)
- Fixed "Calling discardable proc from a defer is an error."
(`#3185 `_)
- Fixed "Defer statement at the end of a block produces ICE"
(`#3186 `_)
- Fixed "Call to `createU` fails to compile"
(`#3193 `_)
- Fixed "VM crash when accessing array's element"
(`#3192 `_)
- Fixed "Unexpected proc invoked when different modules add procs to a type from a 3rd module"
(`#2664 `_)
- Fixed "Nim crashes on conditional declaration inside a template"
(`#2670 `_)
- Fixed "Iterator names conflict within different scopes"
(`#2752 `_)
- Fixed "VM: Cannot assign int value to ref variable"
(`#1329 `_)
- Fixed "Incorrect code generated for tagged unions with enums not starting at zero"
(`#3096 `_)
- Fixed "Compile time procs using forward declarations are silently ignored"
(`#3066 `_)
- Fixed "re binding error in generic"
(`#1965 `_)
- Fixed "os.getCreationTime is incorrect/impossible on Posix systems"
(`#1058 `_)
- Fixed "Improve error message for osproc.startProcess when command does not exist"
(`#2183 `_)
- Fixed "gctest segfaults with --gc:markandsweep on x86_64"
(`#2305 `_)
- Fixed "Coroutine changes break compilation on unsupported architectures"
(`#3245 `_)
- Fixed "Bugfix: Windows 32bit TinyCC support issue fixed"
(`#3237 `_)
- Fixed "db_mysql getValue() followed by exec() causing error"
(`#3220 `_)
- Fixed "xmltree.newEntity creates xnCData instead of xnEntity"
(`#3282 `_)
- Fixed "Methods and modules don't work together"
(`#2590 `_)
- Fixed "String slicing not working in the vm"
(`#3300 `_)
- Fixed "internal error: evalOp(mTypeOf)"
(`#3230 `_)
- Fixed "#! source code prefix collides with Unix Shebang"
(`#2559 `_)
- Fixed "wrong codegen for constant object"
(`#3195 `_)
- Fixed "Doc comments inside procs with implicit returns don't work"
(`#1528 `_)
2015-10-16 First Nim conference
===============================
.. raw::html
This Autumn you have the unique opportunity to take part in the first Nim event
held in Kyiv and to meet the creator of the Nim programming language -
Andreas Rumpf. The event is hosted by Zeo Alliance and is taking place between
14-15 November 2015 in Kyiv, Ukraine.
During the workshop you will learn:
- The basics of the language including its safe and unsafe subsets.
- How to use Nim to develop web applications.
- How Nim's meta programming capabilities make Nim the ultimate glue language,
excellent at interoperability with C++, JavaScript, Java and others.
- Games in Nim and the ability to rapidly prototype without sacrificing speed.
Registration is free, but the number of places is limited. More details
can be found `here `_.
2015-05-04 Version 0.11.2 released
==================================
This is just a bugfix release that fixes the most pressing regressions we
introduced with version 0.11.0. The way types are computed was
changed significantly causing all sort of problems. Sorry for the
inconvenience; we grew overconfident our large test suite would prevent these
things.
2015-04-30 Version 0.11.0 released
==================================
With this release we are one step closer to reaching version 1.0 and by
extension the persistence of the Nim specification. As mentioned in the
previous release notes, starting with version 1.0, we will not be introducing
any more breaking changes to Nim.
The *language* itself is very close to 1.0, the primary area that requires
more work is the standard library.
Take a look at the `download `_ page for binaries (Windows-only)
and 0.11.0 snapshots of the source code. The Windows installer now also
includes `Aporia `_,
`Nimble `_ and other useful tools to get
you started with Nim.
What's left to be done
~~~~~~~~~~~~~~~~~~~~~~
The 1.0 release is expected by the end of this year. Rumors say it will be in
summer 2015. What's left:
* Bug fixes, bug fixes, bug fixes, in particular:
- The remaining bugs of the lambda lifting pass that is responsible to enable
closures and closure iterators need to be fixed.
- ``concept`` needs to be refined, a nice name for the feature is not enough.
- Destructors need to be refined.
- ``static[T]`` needs to be fixed.
- Finish the implementation of the 'parallel' statement.
* ``immediate`` templates and macros will be deprecated as these will soon be
completely unnecessary, instead the ``typed`` or ``untyped`` metatypes can
be used.
* More of the standard library should be moved to Nimble packages and what's
left should use the features we have for concurrency and parallelism.
Changes affecting backwards compatibility
-----------------------------------------
- Parameter names are finally properly ``gensym``'ed. This can break
templates though that used to rely on the fact that they are not.
(Bug #1915.) This means this doesn't compile anymore:
.. code-block:: nim
template doIt(body: stmt) {.immediate.} =
# this used to inject the 'str' parameter:
proc res(str: string) =
body
doIt:
echo str # Error: undeclared identifier: 'str'
..
This used to inject the ``str`` parameter into the scope of the body.
Declare the ``doIt`` template as ``immediate, dirty`` to get the old
behaviour.
- Tuple field names are not ignored anymore, this caused too many problems
in practice so now the behaviour is as it was for version 0.9.6: If field
names exist for the tuple type, they are checked.
- ``logging.level`` and ``logging.handlers`` are no longer exported.
``addHandler``, ``getHandlers``, ``setLogFilter`` and ``getLogFilter``
should be used instead.
- ``nim idetools`` has been replaced by a separate
tool `nimsuggest <0.11.0/nimsuggest.html>`_.
- *arrow like* operators are not right associative anymore and are required
to end with either ``->``, ``~>`` or
``=>``, not just ``>``. Examples of operators still considered arrow like:
``->``, ``==>``, ``+=>``. On the other hand, the following operators are now
considered regular operators again: ``|>``, ``-+>``, etc.
- Typeless parameters are now only allowed in templates and macros. The old
way turned out to be too error-prone.
- The 'addr' and 'type' operators are now parsed as unary function
application. This means ``type(x).name`` is now parsed as ``(type(x)).name``
and not as ``type((x).name)``. Note that this also affects the AST
structure; for immediate macro parameters ``nkCall('addr', 'x')`` is
produced instead of ``nkAddr('x')``.
- ``concept`` is now a keyword and is used instead of ``generic``.
- The ``inc``, ``dec``, ``+=``, ``-=`` builtins now produce OverflowError
exceptions. This means code like the following:
.. code-block:: nim
var x = low(T)
while x <= high(T):
echo x
inc x
Needs to be replaced by something like this:
.. code-block:: nim
var x = low(T).int
while x <= high(T).int:
echo x.T
inc x
- **Negative indexing for slicing does not work anymore!** Instead
of ``a[0.. -1]`` you can
use ``a[0.. ^1]``. This also works with accessing a single
element ``a[^1]``. Note that we cannot detect this reliably as it is
determined at **runtime** whether negative indexing is used!
``a[0.. -1]`` now produces the empty string/sequence.
- The compiler now warns about code like ``foo +=1`` which uses inconsistent
spacing around binary operators. Later versions of the language will parse
these as unary operators instead so that ``echo $foo`` finally can do what
people expect it to do.
- ``system.untyped`` and ``system.typed`` have been introduced as aliases
for ``expr`` and ``stmt``. The new names capture the semantics much better
and most likely ``expr`` and ``stmt`` will be deprecated in favor of the
new names.
- The ``split`` method in module ``re`` has changed. It now handles the case
of matches having a length of 0, and empty strings being yielded from the
iterator. A notable change might be that a pattern being matched at the
beginning and end of a string, will result in an empty string being produced
at the start and the end of the iterator.
- The compiler and nimsuggest now count columns starting with 1, not 0 for
consistency with the rest of the world.
Language Additions
------------------
- For empty ``case object`` branches ``discard`` can finally be used instead
of ``nil``.
- Automatic dereferencing is now done for the first argument of a routine
call if overloading resolution produces no match otherwise. This feature
has to be enabled with
the `experimental <0.11.0/manual.html#pragmas-experimental-pragma>`_ pragma.
- Objects that do not use inheritance nor ``case`` can be put into ``const``
sections. This means that finally this is possible and produces rather
nice code:
.. code-block:: nim
import tables
const
foo = {"ah": "finally", "this": "is", "possible.": "nice!"}.toTable()
- Ordinary parameters can follow after a varargs parameter. This means the
following is finally accepted by the compiler:
.. code-block:: nim
template takesBlock(a, b: int, x: varargs[expr]; blck: stmt) =
blck
echo a, b
takesBlock 1, 2, "some", 0.90, "random stuff":
echo "yay"
- Overloading by 'var T' is now finally possible:
.. code-block:: nim
proc varOrConst(x: var int) = echo "var"
proc varOrConst(x: int) = echo "const"
var x: int
varOrConst(x) # "var"
varOrConst(45) # "const"
- Array and seq indexing can now use the builtin ``^`` operator to access
things from backwards: ``a[^1]`` is like Python's ``a[-1]``.
- A first version of the specification and implementation of the overloading
of the assignment operator has arrived!
- ``system.len`` for strings and sequences now returns 0 for nil.
- A single underscore can now be used to discard values when unpacking tuples:
.. code-block:: nim
let (path, _, _) = os.splitFile("path/file.ext")
- ``marshal.$$`` and ``marshal.to`` can be executed at compile-time.
- Interoperability with C++ improved tremendously; C++'s templates and
operators can be wrapped directly. See
`this <0.11.0/nimc.html#additional-features-importcpp-pragma>`_
for more information.
- ``macros.getType`` can be used to query an AST's type at compile-time. This
enables more powerful macros, for instance *currying* can now be done with
a macro.
Library additions
-----------------
- ``reversed`` proc added to the ``unicode`` module.
- Added multipart param to httpclient's ``post`` and ``postContent`` together
with a ``newMultipartData`` proc.
- Added `%*` operator for JSON.
- The compiler is now available as Nimble package for c2nim.
- Added ``..^`` and ``..<`` templates to system so that the rather annoying
space between ``.. <`` and ``.. ^`` is not necessary anymore.
- Added ``system.xlen`` for strings and sequences to get back the old ``len``
operation that doesn't check for ``nil`` for efficiency.
- Added sexp.nim to parse and generate sexp.
Bugfixes
--------
- Fixed internal compiler error when using ``char()`` in an echo call
(`#1788 `_).
- Fixed Windows cross-compilation on Linux.
- Overload resolution now works for types distinguished only by a
``static[int]`` param
(`#1056 `_).
- Other fixes relating to generic types and static params.
- Fixed some compiler crashes with unnamed tuples
(`#1774 `_).
- Fixed ``channels.tryRecv`` blocking
(`#1816 `_).
- Fixed generic instantiation errors with ``typedesc``
(`#419 `_).
- Fixed generic regression where the compiler no longer detected constant
expressions properly (`#544 `_).
- Fixed internal error with generic proc using ``static[T]`` in a specific
way (`#1049 `_).
- More fixes relating to generics (`#1820 `_,
`#1050 `_,
`#1859 `_,
`#1858 `_).
- Fixed httpclient to properly encode queries.
- Many fixes to the ``uri`` module.
- Async sockets are now closed on error.
- Fixes to httpclient's handling of multipart data.
- Fixed GC segfaults with asynchronous sockets
(`#1796 `_).
- Added more versions to openssl's DLL version list
(`076f993 `_).
- Fixed shallow copy in iterators being broken
(`#1803 `_).
- ``nil`` can now be inserted into tables with the ``db_sqlite`` module
(`#1866 `_).
- Fixed "Incorrect assembler generated"
(`#1907 `_)
- Fixed "Expression templates that define macros are unusable in some contexts"
(`#1903 `_)
- Fixed "a second level generic subclass causes the compiler to crash"
(`#1919 `_)
- Fixed "nim 0.10.2 generates invalid AsyncHttpClient C code for MSVC "
(`#1901 `_)
- Fixed "1 shl n produces wrong C code"
(`#1928 `_)
- Fixed "Internal error on tuple yield"
(`#1838 `_)
- Fixed "ICE with template"
(`#1915 `_)
- Fixed "include the tool directory in the installer as it is required by koch"
(`#1947 `_)
- Fixed "Can't compile if file location contains spaces on Windows"
(`#1955 `_)
- Fixed "List comprehension macro only supports infix checks as guards"
(`#1920 `_)
- Fixed "wrong field names of compatible tuples in generic types"
(`#1910 `_)
- Fixed "Macros within templates no longer work as expected"
(`#1944 `_)
- Fixed "Compiling for Standalone AVR broken in 0.10.2"
(`#1964 `_)
- Fixed "Compiling for Standalone AVR broken in 0.10.2"
(`#1964 `_)
- Fixed "Code generation for mitems with tuple elements"
(`#1833 `_)
- Fixed "httpclient.HttpMethod should not be an enum"
(`#1962 `_)
- Fixed "terminal / eraseScreen() throws an OverflowError"
(`#1906 `_)
- Fixed "setControlCHook(nil) disables registered quit procs"
(`#1546 `_)
- Fixed "Unexpected idetools behaviour"
(`#325 `_)
- Fixed "Unused lifted lambda does not compile"
(`#1642 `_)
- Fixed "'low' and 'high' don't work with cstring asguments"
(`#2030 `_)
- Fixed "Converting to int does not round in JS backend"
(`#1959 `_)
- Fixed "Internal error genRecordField 2 when adding region to pointer."
(`#2039 `_)
- Fixed "Macros fail to compile when compiled with --os:standalone"
(`#2041 `_)
- Fixed "Reading from {.compileTime.} variables can cause code generation to fail"
(`#2022 `_)
- Fixed "Passing overloaded symbols to templates fails inside generic procedures"
(`#1988 `_)
- Fixed "Compiling iterator with object assignment in release mode causes "var not init""
(`#2023 `_)
- Fixed "calling a large number of macros doing some computation fails"
(`#1989 `_)
- Fixed "Can't get Koch to install nim under Windows"
(`#2061 `_)
- Fixed "Template with two stmt parameters segfaults compiler"
(`#2057 `_)
- Fixed "`noSideEffect` not affected by `echo`"
(`#2011 `_)
- Fixed "Compiling with the cpp backend ignores --passc"
(`#1601 `_)
- Fixed "Put untyped procedure parameters behind the experimental pragma"
(`#1956 `_)
- Fixed "generic regression"
(`#2073 `_)
- Fixed "generic regression"
(`#2073 `_)
- Fixed "Regression in template lookup with generics"
(`#2004 `_)
- Fixed "GC's growObj is wrong for edge cases"
(`#2070 `_)
- Fixed "Compiler internal error when creating an array out of a typeclass"
(`#1131 `_)
- Fixed "GC's growObj is wrong for edge cases"
(`#2070 `_)
- Fixed "Invalid Objective-C code generated when calling class method"
(`#2068 `_)
- Fixed "walkDirRec Error"
(`#2116 `_)
- Fixed "Typo in code causes compiler SIGSEGV in evalAtCompileTime"
(`#2113 `_)
- Fixed "Regression on exportc"
(`#2118 `_)
- Fixed "Error message"
(`#2102 `_)
- Fixed "hint[path] = off not working in nim.cfg"
(`#2103 `_)
- Fixed "compiler crashes when getting a tuple from a sequence of generic tuples"
(`#2121 `_)
- Fixed "nim check hangs with when"
(`#2123 `_)
- Fixed "static[T] param in nested type resolve/caching issue"
(`#2125 `_)
- Fixed "repr should display ``\0``"
(`#2124 `_)
- Fixed "'nim check' never ends in case of recursive dependency "
(`#2051 `_)
- Fixed "From macros: Error: unhandled exception: sons is not accessible"
(`#2167 `_)
- Fixed "`fieldPairs` doesn't work inside templates"
(`#1902 `_)
- Fixed "fields iterator misbehavior on break statement"
(`#2134 `_)
- Fixed "Fix for compiler not building anymore since #c3244ef1ff"
(`#2193 `_)
- Fixed "JSON parser fails in cpp output mode"
(`#2199 `_)
- Fixed "macros.getType mishandles void return"
(`#2211 `_)
- Fixed "Regression involving templates instantiated within generics"
(`#2215 `_)
- Fixed ""Error: invalid type" for 'not nil' on generic type."
(`#2216 `_)
- Fixed "--threads:on breaks async"
(`#2074 `_)
- Fixed "Type mismatch not always caught, can generate bad code for C backend."
(`#2169 `_)
- Fixed "Failed C compilation when storing proc to own type in object"
(`#2233 `_)
- Fixed "Unknown line/column number in constant declaration type conversion error"
(`#2252 `_)
- Fixed "Adding {.compile.} fails if nimcache already exists."
(`#2247 `_)
- Fixed "Two different type names generated for a single type (C backend)"
(`#2250 `_)
- Fixed "Ambigous call when it should not be"
(`#2229 `_)
- Fixed "Make sure we can load root urls"
(`#2227 `_)
- Fixed "Failure to slice a string with an int subrange type"
(`#794 `_)
- Fixed "documentation error"
(`#2205 `_)
- Fixed "Code growth when using `const`"
(`#1940 `_)
- Fixed "Instances of generic types confuse overload resolution"
(`#2220 `_)
- Fixed "Compiler error when initializing sdl2's EventType"
(`#2316 `_)
- Fixed "Parallel disjoint checking can't handle `<`, `items`, or arrays"
(`#2287 `_)
- Fixed "Strings aren't copied in parallel loop"
(`#2286 `_)
- Fixed "JavaScript compiler crash with tables"
(`#2298 `_)
- Fixed "Range checker too restrictive"
(`#1845 `_)
- Fixed "Failure to slice a string with an int subrange type"
(`#794 `_)
- Fixed "Remind user when compiling in debug mode"
(`#1868 `_)
- Fixed "Compiler user guide has jumbled options/commands."
(`#1819 `_)
- Fixed "using `method`: 1 in a objects constructor fails when compiling"
(`#1791 `_)
2014-12-29 Version 0.10.2 released
==================================
This release marks the completion of a very important change to the project:
the official renaming from Nimrod to Nim. Version 0.10.2 contains many language
changes, some of which may break your existing code. For your convenience, we
added a new tool called `nimfix `_ that will help you convert your
existing projects so that it works with the latest version of the compiler.
Progress towards version 1.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Although Nim is still pre-1.0, we were able to keep the number of breaking
changes to a minimum so far. Starting with version 1.0, we will not introduce
any breaking changes between major release versions.
One of Nim's goals is to ensure that the compiler is as efficient as possible.
Take a look at the
`latest benchmarks `_,
which show that Nim is consistently near
the top and already nearly as fast as C and C++. Recent developments, such as
the new ``asyncdispatch`` module will allow you to write efficient web server
applications using non-blocking code. Nim now also has a built-in thread pool
for lightweight threading through the use of ``spawn``.
The unpopular "T" and "P" prefixes on types have been deprecated. Nim also
became more expressive by weakening the distinction between statements and
expressions. We also added a new and searchable forum, a new website, and our
documentation generator ``docgen`` has seen major improvements. Many thanks to
Nick Greenfield for the much more beautiful documentation!
What's left to be done
~~~~~~~~~~~~~~~~~~~~~~
The 1.0 release is actually very close. Apart from bug fixes, there are
two major features missing or incomplete:
* ``static[T]`` needs to be defined precisely and the bugs in the
implementation need to be fixed.
* Overloading of the assignment operator is required for some generic
containers and needs to be implemented.
This means that fancy matrix libraries will finally start to work, which used
to be a major point of pain in the language.
Nimble and other Nim tools
~~~~~~~~~~~~~~~~~~~~~~~~~~
Outside of the language and the compiler itself many Nim tools have seen
considerable improvements.
Babel the Nim package manager has been renamed to Nimble. Nimble's purpose
is the installation of packages containing libraries and/or applications
written in Nim.
Even though Nimble is still very young it already is very
functional. It can install packages by name, it does so by accessing a
packages repository which is hosted on a GitHub repo. Packages can also be
installed via a Git repo URL or Mercurial repo URL. The package repository
is searchable through Nimble. Anyone is free to add their own packages to
the package repository by forking the
`nim-lang/packages `_ repo and creating
a pull request. Nimble is fully cross-platform and should be fully functional
on all major operating systems.
It is of course completely written in Nim.
Changelog
~~~~~~~~~
Changes affecting backwards compatibility
-----------------------------------------
- **The language has been renamed from Nimrod to Nim.** The name of the
compiler changed from ``nimrod`` to ``nim`` too.
- ``system.fileHandle`` has been renamed to ``system.getFileHandle`` to
prevent name conflicts with the new type ``FileHandle``.
- Comments are now not part of the AST anymore, as such you cannot use them
in place of ``discard``.
- Large parts of the stdlib got rid of the T/P type prefixes. Instead most
types now simply start with an uppercased letter. The
so called "partial case sensitivity" rule is now active allowing for code
like ``var foo: Foo`` in more contexts.
- String case (or any non-ordinal case) statements
without 'else' are deprecated.
- Recursive tuple types are not allowed anymore. Use ``object`` instead.
- The PEGS module returns ``nil`` instead of ``""`` when an optional capture
fails to match.
- The re module returns ``nil`` instead of ``""`` when an optional capture
fails to match.
- The "symmetric set difference" operator (``-+-``) never worked and has been
removed.
- ``defer`` is a keyword now.
- ``func`` is a keyword now.
- The ``using`` language feature now needs to be activated via the new
``{.experimental.}`` pragma that enables experimental language features.
- Destructors are now officially *experimental*.
- Standalone ``except`` and ``finally`` statements are deprecated now.
The standalone ``finally`` can be replaced with ``defer``,
standalone ``except`` requires an explicit ``try``.
- Operators ending in ``>`` are considered as "arrow like" and have their
own priority level and are right associative. This means that
the ``=>`` and ``->`` operators from the `future `_ module
work better.
- Field names in tuples are now ignored for type comparisons. This allows
for greater interoperability between different modules.
- Statement lists are not converted to an implicit ``do`` block anymore. This
means the confusing ``nnkDo`` nodes when working with macros are gone for
good.
Language Additions
------------------
- The new concurrency model has been implemented including ``locks`` sections,
lock levels and object field ``guards``.
- The ``parallel`` statement has been implemented.
- ``deepCopy`` has been added to the language.
- The builtin ``procCall`` can be used to get ``super``-like functionality
for multi methods.
- There is a new pragma ``{.experimental.}`` that enables experimental
language features per module, or you can enable these features on a global
level with the ``--experimental`` command line option.
Compiler Additions
------------------
- The compiler now supports *mixed* Objective C / C++ / C code generation:
The modules that use ``importCpp`` or ``importObjc`` are compiled to C++
or Objective C code, any other module is compiled to C code. This
improves interoperability.
- There is a new ``parallel`` statement for safe fork&join parallel computing.
- ``guard`` and ``lock`` pragmas have been implemented to support safer
concurrent programming.
- The following procs are now available at compile-time::
math.sqrt, math.ln, math.log10, math.log2, math.exp, math.round,
math.arccos, math.arcsin, math.arctan, math.arctan2, math.cos,
math.cosh, math.hypot, math.sinh, math.sin, math.tan, math.tanh,
math.pow, math.trunc, math.floor, math.ceil, math.fmod,
os.getEnv, os.existsEnv, os.dirExists, os.fileExists,
system.writeFile
- Two backticks now produce a single backtick within an ``emit`` or ``asm``
statement.
- There is a new tool, `nimfix `_ to help you in updating your
code from Nimrod to Nim.
- The compiler's output has been prettified.
Library Additions
-----------------
- Added module ``fenv`` to control the handling of floating-point rounding and
exceptions (overflow, division by zero, etc.).
- ``system.setupForeignThreadGc`` can be used for better interaction with
foreign libraries that create threads and run a Nim callback from these
foreign threads.
- List comprehensions have been implemented as a macro in the ``future``
module.
- The new Async module (``asyncnet``) now supports SSL.
- The ``smtp`` module now has an async implementation.
- Added module ``asyncfile`` which implements asynchronous file reading
and writing.
- ``osproc.kill`` has been added.
- ``asyncnet`` and ``asynchttpserver`` now support ``SO_REUSEADDR``.
Bugfixes
--------
- ``nil`` and ``NULL`` are now preserved between Nim and databases in the
``db_*`` modules.
- Fixed issue with OS module in non-unicode mode on Windows.
- Fixed issue with ``x.low``
(`#1366 `_).
- Fixed tuple unpacking issue inside closure iterators
(`#1067 `_).
- Fixed ENDB compilation issues.
- Many ``asynchttpserver`` fixes.
- Macros can now keep global state across macro calls
(`#903 `_).
- ``osproc`` fixes on Windows.
- ``osproc.terminate`` fixed.
- Improvements to exception handling in async procedures.
(`#1487 `_).
- ``try`` now works at compile-time.
- Fixes ``T = ref T`` to be an illegal recursive type.
- Self imports are now disallowed.
- Improved effect inference.
- Fixes for the ``math`` module on Windows.
- User defined pragmas will now work for generics that have
been instantiated in different modules.
- Fixed queue exhaustion bug.
- Many, many more.
2014-12-09 New website design!
==============================
A brand new website including an improved forum is now live.
All thanks go to Philip Witte and
Dominik Picheta, Philip Witte for the design of the website (together with
the logo) as well as the HTML and CSS code for his template, and Dominik Picheta
for integrating Philip's design with Nim's forum. We're sure you will
agree that Philip's design is beautiful.
2014-10-19 Version 0.9.6 released
=================================
**Note: 0.9.6 is the last release of Nimrod. The language is being renamed to
Nim. Nim slightly breaks compatibility.**
This is a maintenance release. The upcoming 0.10.0 release has
the new features and exciting developments.
Changes affecting backwards compatibility
-----------------------------------------
- ``spawn`` now uses an elaborate self-adapting thread pool and as such
has been moved into its own module. So to use it, you now have to import
``threadpool``.
- The symbol binding rules in generics changed: ``bar`` in ``foo.bar`` is
now considered for implicit early binding.
- ``c2nim`` moved into its own repository and is now a Babel package.
- ``pas2nim`` moved into its own repository and is now a Babel package.
- ``system.$`` for floating point types now produces a human friendly string
representation.
- ``uri.TUrl`` as well as the ``parseurl`` module are now deprecated in favour
of the new ``TUri`` type in the ``uri`` module.
- The ``destructor`` pragma has been deprecated. Use the ``override`` pragma
instead. The destructor's name has to be ``destroy`` now.
- ``lambda`` is not a keyword anymore.
- **system.defined has been split into system.defined and system.declared**.
You have to use ``--symbol`` to declare new conditional symbols that can be
set via ``--define``.
- ``--threadanalysis:on`` is now the default. To make your program compile
you can disable it but this is only a temporary solution as this option
will disappear soon!
Compiler improvements
---------------------
- Multi method dispatching performance has been improved by a factor of 10x for
pathological cases.
Language Additions
------------------
- This version introduces the ``deprecated`` pragma statement that is used
to handle the upcoming massive amount of symbol renames.
- ``spawn`` can now wrap proc that has a return value. It then returns a data
flow variable of the wrapped return type.
Library Additions
-----------------
- Added module ``cpuinfo``.
- Added module ``threadpool``.
- ``sequtils.distnct`` has been renamed to ``sequtils.deduplicate``.
- Added ``algorithm.reversed``
- Added ``uri.combine`` and ``uri.parseUri``.
- Some sockets procedures now support a ``SafeDisconn`` flag which causes
them to handle disconnection errors and not raise them.
2014-04-21 Version 0.9.4 released
=================================
The Nimrod development community is proud to announce the release of version
0.9.4 of the Nimrod compiler and tools. **Note: This release has to be
considered beta quality! Lots of new features have been implemented but
unfortunately some do not fulfill our quality standards yet.**
Prebuilt binaries and instructions for building from source are available
on the `download page `_.
This release includes about
`1400 changes `_
in total including various bug
fixes, new languages features and standard library additions and improvements.
This release brings with it support for user-defined type classes, a brand
new VM for executing Nimrod code at compile-time and new symbol binding
rules for clean templates.
It also introduces support for the brand new
`Babel package manager `_ which
has itself seen its first release recently. Many of the wrappers that were
present in the standard library have been moved to separate repositories
and should now be installed using Babel.
Apart from that a new **experimental** Asynchronous IO API has been added via
the ``asyncdispatch`` and ``asyncnet`` modules. The ``net`` and ``rawsockets``
modules have also been added and they will likely replace the sockets
module in the next release. The Asynchronous IO API has been designed to
take advantage of Linux's epoll and Windows' IOCP APIs, support for BSD's
kqueue has not been implemented yet but will be in the future.
The Asynchronous IO API provides both
a callback interface and an interface which allows you to write code as you
would if you were writing synchronous code. The latter is done through
the use of an ``await`` macro which behaves similar to C#'s await. The
following is a very simple chat server demonstrating Nimrod's new async
capabilities.
.. code-block::nim
import asyncnet, asyncdispatch
var clients: seq[PAsyncSocket] = @[]
proc processClient(client: PAsyncSocket) {.async.} =
while true:
let line = await client.recvLine()
for c in clients:
await c.send(line & "\c\L")
proc serve() {.async.} =
var server = newAsyncSocket()
server.bindAddr(TPort(12345))
server.listen()
while true:
let client = await server.accept()
clients.add client
processClient(client)
serve()
runForever()
Note that this feature has been implemented with Nimrod's macro system and so
``await`` and ``async`` are no keywords.
Syntactic sugar for anonymous procedures has also been introduced. It too has
been implemented as a macro. The following shows some simple usage of the new
syntax:
.. code-block::nim
import future
var s = @[1, 2, 3, 4, 5]
echo(s.map((x: int) => x * 5))
A list of changes follows, for a comprehensive list of changes take a look
`here `_.
Library Additions
-----------------
- Added ``macros.genSym`` builtin for AST generation.
- Added ``macros.newLit`` procs for easier AST generation.
- Added module ``logging``.
- Added module ``asyncdispatch``.
- Added module ``asyncnet``.
- Added module ``net``.
- Added module ``rawsockets``.
- Added module ``selectors``.
- Added module ``asynchttpserver``.
- Added support for the new asynchronous IO in the ``httpclient`` module.
- Added a Python-inspired ``future`` module that features upcoming additions
to the ``system`` module.
Changes affecting backwards compatibility
-----------------------------------------
- The scoping rules for the ``if`` statement changed for better interaction
with the new syntactic construct ``(;)``.
- ``OSError`` family of procedures has been deprecated. Procedures with the same
name but which take different parameters have been introduced. These procs now
require an error code to be passed to them. This error code can be retrieved
using the new ``OSLastError`` proc.
- ``os.parentDir`` now returns "" if there is no parent dir.
- In CGI scripts stacktraces are shown to the user only
if ``cgi.setStackTraceStdout`` is used.
- The symbol binding rules for clean templates changed: ``bind`` for any
symbol that's not a parameter is now the default. ``mixin`` can be used
to require instantiation scope for a symbol.
- ``quoteIfContainsWhite`` now escapes argument in such way that it can be safely
passed to shell, instead of just adding double quotes.
- ``macros.dumpTree`` and ``macros.dumpLisp`` have been made ``immediate``,
``dumpTreeImm`` and ``dumpLispImm`` are now deprecated.
- The ``nil`` statement has been deprecated, use an empty ``discard`` instead.
- ``sockets.select`` now prunes sockets that are **not** ready from the list
of sockets given to it.
- The ``noStackFrame`` pragma has been renamed to ``asmNoStackFrame`` to
ensure you only use it when you know what you're doing.
- Many of the wrappers that were present in the standard library have been
moved to separate repositories and should now be installed using Babel.
Compiler Additions
------------------
- The compiler can now warn about "uninitialized" variables. (There are no
real uninitialized variables in Nimrod as they are initialized to binary
zero). Activate via ``{.warning[Uninit]:on.}``.
- The compiler now enforces the ``not nil`` constraint.
- The compiler now supports a ``codegenDecl`` pragma for even more control
over the generated code.
- The compiler now supports a ``computedGoto`` pragma to support very fast
dispatching for interpreters and the like.
- The old evaluation engine has been replaced by a proper register based
virtual machine. This fixes numerous bugs for ``nimrod i`` and for macro
evaluation.
- ``--gc:none`` produces warnings when code uses the GC.
- A ``union`` pragma for better C interoperability is now supported.
- A ``packed`` pragma to control the memory packing/alignment of fields in
an object.
- Arrays can be annotated to be ``unchecked`` for easier low level
manipulations of memory.
- Support for the new Babel package manager.
Language Additions
------------------
- Arrays can now be declared with a single integer literal ``N`` instead of a
range; the range is then ``0..N-1``.
- Added ``requiresInit`` pragma to enforce explicit initialization.
- Exported templates are allowed to access hidden fields.
- The ``using statement`` enables you to more easily author domain-specific
languages and libraries providing OOP-like syntactic sugar.
- Added the possibility to override various dot operators in order to handle
calls to missing procs and reads from undeclared fields at compile-time.
- The overload resolution now supports ``static[T]`` params that must be
evaluable at compile-time.
- Support for user-defined type classes has been added.
- The *command syntax* is supported in a lot more contexts.
- Anonymous iterators are now supported and iterators can capture variables
of an outer proc.
- The experimental ``strongSpaces`` parsing mode has been implemented.
- You can annotate pointer types with regions for increased type safety.
- Added support for the builtin ``spawn`` for easy thread pool usage.
Tools improvements
------------------
- c2nim can deal with a subset of C++. Use the ``--cpp`` command line option
to activate.
2014-02-11 Nimrod Featured in Dr. Dobb's Journal
================================================
Nimrod has been `featured`_
as the cover story in the February 2014 issue of Dr. Dobb's Journal.
2014-01-15 Andreas Rumpf's talk on Nimrod at Strange Loop 2013 is now online
============================================================================
Andreas Rumpf presented *Nimrod: A New Approach to Metaprogramming* at
`Strange Loop 2013`_.
The `video and slides`_
of the talk are now available.
2013-05-20 New website design!
==============================
A brand new website is now live. All thanks go to Philip Witte and
Dominik Picheta, Philip Witte for the design of the website (together with
the logo) as well as the HTML and CSS code for his template, and Dominik Picheta
for integrating Philip's design with the ``nimweb`` utility. We're sure you will
agree that Philip's design is beautiful.
2013-05-20 Version 0.9.2 released
=================================
We are pleased to announce that version 0.9.2 of the Nimrod compiler has been
released. This release has attracted by far the most contributions in comparison
to any other release.
This release brings with it many new features and bug fixes, a list of which
can be seen later. One of the major new features is the effect system together
with exception tracking which allows for checked exceptions and more,
for further details check out the `manual `_.
Another major new feature is the introduction of statement list expressions,
more details on these can be found `here `_.
The ability to exclude symbols from modules has also been
implemented, this feature can be used like so: ``import module except symbol``.
Thanks to all `contributors