Proposed improvements to the separate compilation model
Brad Roberts
braddr at slice-2.puremagic.com
Fri Jul 22 16:03:56 PDT 2011
On Fri, 22 Jul 2011, Andrei Alexandrescu wrote:
> On 7/22/11 5:06 PM, Andrei Alexandrescu wrote:
> [snip]
>
> I almost forgot - we should also have a means to allow a class to import its
> own incomplete declaration, as follows:
>
> // a.di
> class A { private int x; int foo(); }
>
> // a.d
> import a;
> class A { private int x; int foo() { return x + 1; }
}
>
> The compiler should accept this because that's what the .di generator outputs.
> The import will be used as a means to verify that the layout declared in the
> .di file is identical to the one in the .d file.
>
> Without this feature, it would be impossible for the compiler to ensure that
> no inadvertent change was made to one of the files.
>
>
> Andrei
How about another case:
// a.di
class A { private int; int foo() { return x+1; } }
// a.d
imoprt a;
class A { private int; int foo() { return x+1; } }
ie, a case where the .di file has a function body (be it due to manual
creation or automatic). How closely do they need to match?
Later,
Brad
More information about the Digitalmars-d
mailing list