Resource management (eg. try-with-resources)
Michał Wadas
michalwadas at gmail.com
Fri Nov 10 15:00:32 UTC 2017
After I started writing code extensively using async-await I have noticed
that I would like to have automated way of dealing with resource management.
Scope-level manage was proven (Python, C++, Java at least) to be intuitive
and error proof.
Previous discussion on this topic: https://esdiscuss.
org/topic/resource-management
Example syntax:
try with Expression as Identifier {
} catch... finally...
Symbol.open and Symbol.close methods would be called respectively on
entering and leaving try block.
Plays well with both synchronous and asynchronous resource access.
Another option is to reuse with:
with(expression as identifier) {
}
Though it would be confusing to statement with wildly different semantics
in strict mode.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171110/6acf4fe0/attachment.html>
More information about the es-discuss
mailing list