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

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Oct 27 06:07:16 UTC 2017


On Wednesday, 25 October 2017 at 22:19:23 UTC, Walter Bright 
wrote:
> for core D devs.
>
> "How Non-Member Functions Improve Encapsulation" by Scott Meyers
>
> http://www.drdobbs.com/cpp/how-non-member-functions-improve-encapsu/184401197
>
> Note that I'm as guilty as anyone for not understanding or 
> following these guidelines. I expect we can do much better.

The irony is that D’s private is “public to anyone in this 
module”. With that in mind free function or not you don’t get 
anything.

Splitting it off to another module is clunky and I’d use it only 
for functions that may work for different types (template).






More information about the Digitalmars-d mailing list