Try blocks are trying
Carl Sturtivant
sturtivant at gmail.com
Sun Oct 10 16:12:31 UTC 2021
Why is it that a try block is defined to establish a scope?
```
try {
auto x = frgl();
}
// ...
// x undefined here
```
What is the benefit of this? If try (like static if/foreach) did
NOT establish a scope, then this annoyance would go away. And if
a scope was desired for some reason, then an extra pair of braces
could be written within.
Right now rewriting the above requires getting the return type of
frgl and declaring x to be of that type before the try block.
Design error?
More information about the Digitalmars-d
mailing list