3 ms·
No. What Katz really needs is not blocks, but RAII. See Python’s with statement or C#’s using statement.
by dahlia 15y ago
No. What Katz really needs is not blocks, but RAII. See Python’s with statement or C#’s using statement.
- LeafStorm 15y agoYou can do RAII using `with` or `using` blocks, but you can't control execution with those like you can with blocks - the body of the `with` or `using` statement will always execute once. You can't prevent it from executing (unless you throw an exception), and you can't re-execute it with different values in the `as` clause.
- MartinMond 15y agoWhat advantage would we get by only having RAII over full block syntax? (Not sure, you can do using(some-other-method(file)) in C#?)