On Mon, 06 Oct 2014 11:54:55 +0000 John Colvin via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> I disagree. It's simple and easy to understand. and hackish. > This is the only genuine problem I can see that requires a > language extension. Separating class definition from method > definition in to different compilation units doesn't allow access > to private members without very nasty hacks. no hacks needed. == pkg.classdef.d == module pkg.classdef; class A { private: int hiddenField; int bar (); } == pkg.othermodule.d === module pkg.othermodule; import pkg.classdef; // this imlements A.bar() declared in pkg.classdef: @implementation(A) int bar () { return this.hiddenField; } compiler is perfectly able to put A.bar() implementation in the scope of A, and then A.bar can access anything in A. it's the same as declaring bar() in class definition.
signature.asc
Description: PGP signature