, 18 2020 . 19:01
+
D_KEY:
applegame @ . RAII - , .
?
, , defer/scope(exit).
- .
:
std::lock_guard lock(mtx);
mtx.lock();
scope(exit) mtx.unlock();
, bracket pattern haskell:
main = do
withFile "foo.txt" ReadMode (\handle -> do
...)
, .
. , RAII, .
;)
Ruby Kotlin, . bracket pattern , .
applegame @ , scope(exit) , RAII.
:)
, defer/scope(exit) finally( ).
using/with/try-with-resources. , .
with*-. , "" ( RAII), .
RAII . , /.
https://forum.sources.ru/index.php?showtopic=362619&view=findpost&p=3834556
:
Holy Wars