DIP 1002 (TryElseExpression) added to the queue

Marc Sch├╝tz via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 29 04:45:42 PDT 2016


On Wednesday, 28 September 2016 at 22:12:27 UTC, Idan Arye wrote:
>     Foo foo;
>     try {
>         foo = Foo();
>     } catch (FooCreationException) {
>         // ...
>     } else {
>         foo.doSomethingWithFoo();
>     }
>     // foo exists here - it could be initialized, it could be 
> not...

And `Foo` could have `@disabled this()`, so you simply _can't_ 
declare it without initializing it (or use the dirty `Foo foo = 
Foo.init` workaround). But of course, that's a corner case...


More information about the Digitalmars-d mailing list