With statement become like C#'s using?

Michal Minich michal.minich at gmail.com
Mon Aug 5 06:41:59 PDT 2013


On Monday, 5 August 2013 at 13:33:28 UTC, Adam D. Ruppe wrote:
> On Monday, 5 August 2013 at 12:40:26 UTC, Bosak wrote:
>> with(Bitmap image = open("filename.bmp")) {
>
> I think this shoudl be allowed simply for consistency with this:
>
> if(auto a = getfoo()) { use a }

This is good. I think it should too.

But what Bosak proposes is that when "with" statements ends, the 
object should be destructed, which is large violation what with 
statements if for. Not mentioning breaking all the existing 
code...


More information about the Digitalmars-d mailing list