Proposed improvements to the separate compilation model

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Jul 23 07:21:26 PDT 2011


On 7/23/11 12:34 AM, 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?

It was on the phone.

> 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.

Imposing one interface for each class hierarchy is an option, but not an 
attractive one. It's essentially requiring boilerplate.

> 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.

There are not many D large projects at the time being, and everybody who 
worked on one has had problems. Large projects will come, and the 
language must be prepared. This _is_ important. Of course, it can happen 
only of a contributor owns this. We'd be hasty to dismiss the issue though.


Thanks,

Andrei


More information about the Digitalmars-d mailing list