splicing tested and documented
This commit is contained in:
parent
a0a8934a4f
commit
22115a2c6a
7 changed files with 72 additions and 30 deletions
31
todo.txt
31
todo.txt
|
|
@ -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
|
||||
=============
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue