splicing tested and documented

This commit is contained in:
Araq 2011-10-28 17:57:58 +02:00
commit 22115a2c6a
7 changed files with 72 additions and 30 deletions

View file

@ -5,7 +5,6 @@ Version 0.8.14
- 'let x = y'
- fix actors.nim
- make threadvar efficient again on linux after testing
- document & test splicing; don't forget to test negative indexes
- dead code elim for JS backend
@ -17,6 +16,36 @@ incremental compilation
- implement lib/pure/memfiles properly
Destructors
-----------
A destructor is bound to a proc instead of a type. The proc is then called
an *init proc*. A destructor is called at
scope exit for the local variables (declared with ``var`` or ``let``)
that are initialized with its corresponding init proc:
.. code-block:: nimrod
proc autoOpen(filename: string): TFile {.destructor: close.} =
result = open(filename)
var f = autoOpen("abc.txt")
A template ``atScopeExit`` can easily be defined with this mechanism. However
unfortunately the regex problem is not solved at all:
.. code-block:: nimrod
if x =~ re"abc":
...
We really need some form of escape analysis; ``var`` or ``let`` is not enough!
Hm, but what if the procs declare that property:
.. code-block:: nimrod
proc `=~` (s: string, pattern: TRegex{.noEscape.}): bool
So it's bound to a type again?
version 0.9.0
=============