On Saturday, 12 May 2018 at 15:48:53 UTC, KingJoffrey wrote:
On Saturday, 12 May 2018 at 13:38:18 UTC, Walter Bright wrote:
Mike's right. D's encapsulation model is designed around the
module.
Actually, that is not true. If it were true, then I could do:
------------
module test;
void main() { i = 2; } // sorry, but i belongs to another unit
of encapsulation
void foo() { int i = 1; }
------------
No, it would be like:
------------
module test;
void main() { foo.i = 2; }
of encapsulation
void foo() { static int i = 1; }
------------
...and I think there might be point in allowing that.
Non-static members could also perhaps be accessed in case of
fibers, but that would likely be tough to implement and/or
complicate the runtime.