kevinc1846 at googlemail.com
Mon Jun 22 14:47:42 PDT 2009
Any plans for RAII style functionality for ES6/Harmony. (It was
briefly discussed re ES4 here:
For example, a decorator style syntax which expands to code to do the
@raii f = new File("test.txt") // expands to 'let f = new
File("test.txt");f.open()' and try/finally
} // file is cleaned up/closed
Or a new keyword - say c#'s 'using'. Reuse 'with' - maybe not. Is
there overlap re iterators and automatic closing of the iterator in a
for loop. Like the Lisp macro with-open-file.
It's useful for memory management to distinguish between short-lived
(stack) and long-lived (heap) objects. Could the @raii decorator
provide a 'hint' to the VM gc that the object is short lived to assist
memory management. Or even a @auto decorator or keyword. If a
developer states their semantics upfront - this is a short-lived stack
style object - then maybe they could get improved performance. This
would not be a instruction to the gc to reclaim the memory immediately
once the block is exited - just a hint.
Decorators/AOP seem to be have macro style functionality. Are
decorators/AOP or even full macro's part of the plans for ES6?
More information about the es-discuss