https://issues.dlang.org/show_bug.cgi?id=4733
Nick Treleaven <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #38 from Nick Treleaven <[email protected]> --- For the record, this post described why the revert happened: https://forum.dlang.org/post/[email protected] "The main reason why it caused issues is this nice idiom: if(auto arr = someFunction()) { // use arr } This would HAVE to be split out to two statements, and the arr variable would be scoped outside of the if statement." I attempted to make it obsolete: https://github.com/dlang/dmd/pull/15413 But that was rejected. I still think it would be good to do for editions. If that is still a no-go then it seems we need something like: if ((auto arr = expr).ptr) However, would `arr` then be declared in the `else` branch? If so that is still not a replacement for the feature. Another option would be to allow `if (auto arr = expr)` but allow no other uses of an array as a boolean. --
