Proposed improvements to the separate compilation model
Jonathan M Davis
jmdavisProg at gmx.com
Sat Jul 23 02:42:44 PDT 2011
On Saturday 23 July 2011 07:34:43 Andrej Mitrovic wrote:
> On 7/23/11, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> > Currently, in order for a program with separately-implemented methods to
> > work properly, there must be TWO different files for the same class
>
> Can we get a chat log of this discussion to figure out what is trying
> to be solved here?
>
> interface IFoo
> {
> int foo();
> }
>
> class Foo : IFoo
> {
> private int x;
>
> version(one)
> {
> int foo() { return x; }
> }
> else
> version(two)
> {
> int foo() { return x++; }
> }
> }
>
> $ dmd -c foo.d -version=one
>
> or:
>
> class Foo : IFoo
> {
> mixin(import("FooImpl.d"));
> }
>
> $ dmd -c foo.d -J./my/foo/
>
> There are probably other ways to do this within the existing framework.
>
> My vote goes to Walter and other contributors to work on fixing
> existing bugs so we can have not a perfect but a working language.
One of the key issues at hand is the fact that if you have a .di file and no
actual implementation for a particular function, then you can't use that
function in CTFE.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list