Post-ctor ctor

David Nadlinger see at klickverbot.at
Mon Aug 8 13:22:31 PDT 2011


On 8/8/11 6:08 AM, Andrei Alexandrescu wrote:
> On 8/7/11 1:16 PM, Andrej Mitrovic wrote:
>> struct Foo
>> {
>> int a;
>> int b;
>> int c;
>> int d;
>> }
> Just define a mixin and use it:
>
> this(int a, int b, int c, int d) {
> mixin(initFromParameters());
> ...
> }

There is currently no »legal« way to get the parameter names in D (other 
than parsing the .stringof output for the function type, which is not 
guaranteed to work, as far as I know), so I don't see how this could be 
implemented. Did I miss something obvious?

David


More information about the Digitalmars-d mailing list