[Issue 17138] Warn about superfluous "with" statements

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat May 13 14:53:25 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17138

--- Comment #5 from Eyal <eyal at weka.io> ---
Another case that is beneficial and should not be an error:

If the expression results in an object that scopes over the block and has a
destructor. 

Example:

with(someMutex.acquired) {

  // No use of any fields from the MutexAcquired object

} // dtor of MutexAcquired called here, releasing the mutex

So here you'd want no error either.

--


More information about the Digitalmars-d-bugs mailing list