member arguments in D?

Daniel Keep daniel.keep.lists at gmail.com
Sun Apr 26 01:17:04 PDT 2009



Penguin wrote:
> What do you think about:
> 
> class Foo {
> 
>    int a;
>    float b;
> 
>    this( member a, member b ) {
> 
>    } 
> 
> }
> 
> instead of:
> 
> class Foo {
> 
>    int a;
>    float b;
> 
>    this( int a, float b ) {
>       this.a = a;
>       this.b = b;
>    } 
> 
> }

I don't know that saving a few (very simple) lines of code is worth
adding a new keyword and magic behaviour to ctor arguments.

If you really wanted to just do that, you could probably write a mixin
to take care of it.

  -- Daniel



More information about the Digitalmars-d mailing list