Required Reading: "How Non-Member Functions Improve Encapsulation"

Kagamin spam at here.lot
Fri Oct 27 09:02:27 UTC 2017


On Thursday, 26 October 2017 at 23:29:24 UTC, Walter Bright wrote:
> The point is that functions that do not need access to private 
> fields should NOT be part of the class. Most of the discussion 
> here is based on the idea that those functions should still be 
> semantically part of the class, even if not physically. That 
> idea should be revisited. Why should they be semantically part 
> of the class?

Because it's functionality of the class. If it's not available, 
it will be reimplemented and duplicated. C++ doesn't have such 
problem, because in a way all imports are public there so you 
have no chance to separate a function from type.


More information about the Digitalmars-d mailing list