proposal: allow 'with(Foo):' in addition to 'with(Foo){..}'

Era Scarecrow via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 10 01:56:17 PDT 2014


On Sunday, 10 August 2014 at 08:45:00 UTC, safety0ff wrote:
> For that specific case, put it outside the switch and drop the 
> colon:

  True, although if you repeat having to work with the type of Foo 
(or Flags or something) multiple times then the with(): would let 
you avoid having multiple extra levels of braces. In one of my 
projects i recall having something like 2-3 levels of with mostly 
carrying around flags for various enum types and it was quite 
ugly.

  with(a) with(b) with(c){
    //code
  }

  I forget, but it wasn't very pretty... And there were several 
functions like that, as well as static data outside of functions 
that needed it. I might have ended up using aliasing, but it 
wasn't a good solution, more a patch on the problem than a fix.


More information about the Digitalmars-d mailing list