new DIP47: Outlining member functions of aggregates

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Sep 7 12:43:57 PDT 2013


On 9/7/13, Walter Bright <newshound2 at digitalmars.com> wrote:
> http://wiki.dlang.org/DIP47

Your example code:

-----
struct S {
    static int mfunc(int a, int b = 5) pure;	// member function declaration
}

int S.mfunc(int a, int b) pure {	// member function definition
    ...
}
-----

Two things:

1. Why are you demonstrating static functions and not regular member
functions (or better yet why not both)?

2. Why has 'static' been removed at the outlined implementation
function? It should also be there:

static int S.mfunc(int a, int b) pure {	// member function definition
}

To reiterate, let's not introduce a feature where we can be totally
lax about what we do at the declaration and implementation site. My
strong opinion is that the declaration and implementation must
perfectly match, otherwise you can throw the readability argument out
the window.


More information about the Digitalmars-d mailing list