Nicer syntax for constructors

Trailzz email at example.com
Sun Nov 18 19:09:16 UTC 2018


This situation happens *very* often in object oriented 
programming:
```
this(string a, int b, char c, float d, uint e, bool f)
{
     this.a = a;
     this.b = b;
     this.c = c;
     this.d = d;
     this.e = e;
     this.f = f;
}
```

It would save a lot of code bloat if there was a simpler syntax 
for this, perhaps something like this:
```
this(string this.a, int this.b, char this.c, float this.d, uint 
this.e, bool this.f)
{
}
```

It would be very easy to infer the types here, so this could also 
work
```
this(this.a, this.b, this.c, this.d, this.e, this.f)
{
}
```

I'm not sure exactly what the syntax would be like, but I just 
wanted to know what other people think about this. Would it be 
worth creating a DIP for this?


More information about the Digitalmars-d mailing list