On 10/09/13 14:12, Jacob Carlborg wrote:
verifyDeclarations would look something like this, in pseudo code:void* verifyDeclarations (T) () { static if (is(T == class)) { foreach (member ; methods!(T)) { static if (!hasDefinition!(member)) static assert (false, "The member '" fullyQualifiedName!(T) ~ "." ~ member.stringof ~ "' doesn't have a definition"); } } return null; }
But the problem that I identified wasn't the possibility of members that are declared but not defined. It was the possibility of members that are defined but not included in the top-of-the-class list of separate declarations. The whole point is that both the author and the recipient of the code should be able to verify at compile-time that the list of declarations is an accurate summary of the class.
I imagine you could define a verifySeparateDeclarations that would indeed enforce that (for every declaration a definition, and for every definition a separate declaration) but that would have its own issues.
