new DIP47: Outlining member functions of aggregates

Andrej Mitrovic andrej.mitrovich at gmail.com
Mon Sep 9 13:01:06 PDT 2013


On 9/9/13, Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> wrote:
> A well-defined rule for separating out declarations and definitions would
> check
> for that and throw a compile error.

You could use compile-time introspection where the API would look like:

class C
{
    void foo();
    void foo() { }
    void bar() { }  // missing declaration
    mixin VerifyDeclarations;
}

And this would statically assert if there's a missing declaration for
a definition. I think this might even be doable with the current
introspection features, although I'm not sure whether we have a way to
determine if something is a declaration or a definition. Certainly
such a trait could easily be added to the compiler.


More information about the Digitalmars-d mailing list