"with" should be deprecated with extreme prejudice

Johan Granberg lijat.meREM at OVEgmail.com
Mon May 18 00:27:26 PDT 2009


BCS wrote:

> Hello Andrei,
> 
>> I think "with" is a very dangerous feature due to the way it hides
>> symbols. It essentially makes the feeblest attempt at modular
>> reasoning utterly impossible:
>> 
>> int x, y;
>> with (whatever)
>> {
>> y += x;
>> ++x;
>> }
>>
>> Maintenance of any type that is being used with "with" becomes a very
>> dangerous proposition because it can silently change meaning of code.
> 
> I'd be willing to go the half way solution of making accessing a shadowing
> symbol an error, resulting in (loudly) not being able to access either.

I think this solution is a good idea but that removing or restricting
anything more regarding with is a bad idea as others have pointed out.

I'm using with quit a lot and it was one of thous things that attracted me
to D (I get the feeling that D has a quite pragmatic way of looking at
language features, if it's usefull lets have it unless it's harmfull to
other parts of D, sort of.).

On a similar note, Andrei, what is this spree of removing features? Ok some
are obviously bad, imaginary types for example, but why remove other stuff
such as commplex and with?



More information about the Digitalmars-d mailing list