diff options
Diffstat (limited to 'todo.txt')
-rwxr-xr-x | todo.txt | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/todo.txt b/todo.txt index 6455ca8a4..de27c6fa1 100755 --- a/todo.txt +++ b/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 ============= |