Adding a new design constraint to D

Paul Backus snarwin at gmail.com
Tue Jun 14 19:39:40 UTC 2022


On Tuesday, 14 June 2022 at 17:16:04 UTC, Dom Disc wrote:
> On Tuesday, 14 June 2022 at 10:47:18 UTC, forkit wrote:
>> Now I need a suitable, enforcable, design constraint, so i can 
>> unfriend.
>
> Yes, now we're talking. What we need is no new level of 
> privacy, we need a method to unfriend something - especially 
> applicable also to member functions. THIS would give us some 
> real new benefit.

If a function doesn't need access to private member variables, 
don't implement it as a member function. Instead, put it in a 
separate module and call it using UFCS.

https://www.ddj.com/cpp/how-non-member-functions-improve-encapsu/184401197


More information about the Digitalmars-d mailing list