Proposed improvements to the separate compilation model

Robert Clipsham robert at octarineparrot.com
Sun Jul 24 08:42:22 PDT 2011


On 22/07/2011 23:06, Andrei Alexandrescu wrote:
> I see this as a source of problems going forward, and I propose the
> following changes to the language:
>
> 1. The compiler shall accept method definitions outside a class.
>
> 2. A method cannot be implemented unless it was declared with the same
> signature in the class definition.

So what you're proposing is akin to this in C++?

class A
{
   void foo();
}

void A::foo()
{
}

The equivalent D being s/::/./? My question is then, do we allow 
something like:

// a.d
class A
{
   void foo();
}

// b.d
import a;
void A.foo() {}

Which causes the module system to breakdown somewhat, or do we require 
the method to be implemented in the same module (.di or .d)?

-- 
Robert
http://octarineparrot.com/


More information about the Digitalmars-d mailing list