www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17138] New: Warn about superfluous "with" statements


          Issue ID: 17138
           Summary: Warn about superfluous "with" statements
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: eyal weka.io

When using:

  with(someObject) {

And none of the expressions within BODY actually use any members of
"someObject", and the destructor of "someObject" is not called at the end of
the "with" statement, it is a likely bug.

I use the following RAII idiom:

  with(someLock.acquired()) {

But get no warning if I accidentally:

  with(someLock) {

Feb 02 2017