"with" should be deprecated with extreme prejudice

Nick Sabalausky a at a.a
Sun May 17 22:12:51 PDT 2009


"Robert Fraser" <fraserofthenight at gmail.com> wrote in message 
news:guqpkf$2h49$2 at digitalmars.com...
>
> I mainly use it for initialization of things:
>
> static S opCall(_x, _y)
> {
> S s;
> with(s)
> {
> x = _x;
> y = _y;
> happiness = null;
> }
> return s;
> }

For things like that I have a series of util mixins, for example:

class Foo
{
    int x;
    int y;
    char[] name;
    this(int x, int y, char[] name)
    {
        mixin(initMember!(x, y, name));
    }
}

And even if I didn't, I've never considered the repeated "this." or "s.", 
etc, to be non-trivial enough to really be worth an extra language 
construct - and I'm normally a complete DRY-maniac. 





More information about the Digitalmars-d mailing list