On Sunday, 21 October 2018 at 03:17:23 UTC, 12345swordy wrote:
So that classes can share some of their variables but not others in a module.

IE.

class A
{
internal int A; //This is shared in the module
private int B; // But not this.
}

No need to reintroduce the "Friend" feature from cpp.

I partially agree because Object Pascal uses `strict private` for this. IIRC they needed at some point to make this for their Objective-C compatibility. I find it occasionally useful for example to enforce the usage of the getters method over their matching fields (if they do lazy update, lazy init, or such things). So far in D the way to do this is to put the stuff that has to be strictly private (or internal if you prefer) in a dedicated module.

This suggestion comes semi-regularly on the forum and last time it did, the whole topic got very unfriendly so while i partially agree i have to say that i don't really care. It's a small sympathetic feature, but i can live without.

Baz.

Reply via email to