Proposed improvements to the separate compilation model

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Jul 22 22:34:43 PDT 2011


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.


More information about the Digitalmars-d mailing list