60 ms·
Reminds me of C#.. IDisposible and IAsyncDisposible in C# helps a lot to write good mechanisms for things that should actually be abstracted in a nice way (such
by havkom 1y ago
Reminds me of C#.. IDisposible and IAsyncDisposible in C# helps a lot to write good mechanisms for things that should actually be abstracted in a nice way (such as locks handling, queue mechanisms, temporary scopes for impersonation, etc).
- masklinn 1y agoIt's basically lifted from C#'s, the original proposal makes no secret of it and cites all of Python's context managers, Java's try with resources, C#'s using statements, and C#'s using declarations. And `using` being the keyword and `dispose` the hook method is a pretty big hint.
- pwdisswordfishz 1y agoThat's because the author of the proposal is from Microsoft and has repeatedly shot down counter-suggestions that made the syntax look different from C#. https://github.com/tc39/proposal-explicit-resource-management/issues/237 https://github.com/tc39/proposal-explicit-resource-managemen... https://github.com/tc39/proposal-explicit-resource-management/issues/199 https://github.com/tc39/proposal-explicit-resource-managemen... https://github.com/tc39/proposal-explicit-resource-management/issues/92 https://github.com/tc39/proposal-explicit-resource-managemen... https://github.com/tc39/proposal-explicit-resource-management/issues/77#issuecomment-1030679166 https://github.com/tc39/proposal-explicit-resource-managemen...