new DIP47: Outlining member functions of aggregates

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Mon Sep 9 12:59:35 PDT 2013


On 09/09/13 21:30, Jonathan M Davis wrote:
> Walter's proposal would be no different on that count. All that the DIP is
> proposing is a way to define a member function outside of a class. That
> requires that it already be declared in the class, but it doesn't make it so
> that you can't define other functions directly in the class.

Sure.  The thing is that if you can only declare and define within the class, 
this potential problem is unavoidable -- you can _never_ be certain that your 
list of declarations is complete.

If on the other hand you can define outside the class declaration, then you can 
make it a design decision to only declare within the class declaration, and to 
define elsewhere in the module.  In that case it should be possible to guarantee 
a safety check that what's declared is defined and what's defined is declared -- 
and that the two match precisely.


More information about the Digitalmars-d mailing list