Split class declaration and definition

Kozzi11 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 31 05:02:20 PDT 2014


On Thursday, 31 July 2014 at 11:41:07 UTC, FreeSlave wrote:
> On Thursday, 31 July 2014 at 11:34:38 UTC, Kozzi11 wrote:
>> Is possible to somehow split class declaration and definition.
>>
>> I mean something like this:
>>
>> class C
>> {
>>    void hello(); // just prototype
>> }
>>
>> class C
>> {
>>    void hello()
>>    {
>>        //actual code
>>    }
>> }
>>
>> or something like this
>> void C.hello() {
>>    //actual code
>> }
>
> dmd -c -o- -H yourmodule.d
>
> will create .di file (i.e. interface)

I know that, but this is not exactly what I mean. I mean 
something like this: http://wiki.dlang.org/DIP47 .
I will have something like:

module m;
@someUda
class C {
     void someFun();
}

@someUda
class D {
     void anotherFun();
}

mixin(generateFunDefForClassesWithSomeUda!m);



More information about the Digitalmars-d-learn mailing list