Wed Oct 17 - Avoiding Code Smells by Walter Bright
Atila Neves
atila.neves at gmail.com
Tue Nov 6 11:55:19 UTC 2018
On Friday, 2 November 2018 at 10:18:11 UTC, ShadoLight wrote:
> On Friday, 2 November 2018 at 00:53:52 UTC, H. S. Teoh wrote:
>>
>> And along that line, recent wisdom is that it's better to move
>> things *out* of classes (and structs) if they don't need
>> access to private members. (Sorry, I wanted to include a link
>> for this, but I couldn't find the article -- the title eludes
>> me and google isn't turning up anything useful.) Class and
>> struct APIs should be as minimal as possible -- just enough to
>> do what needs to be done and no more, and the rest of the
>> syntactic sugar (that makes it more palatable to your users)
>> belongs outside as optional convenience functions.
>>
>
> Maybe you are thinking of the "Prefer non-member non-friend
> functions to member functions" rule from Herb Sutter's
> "Effective C++" books?
C++ however doesn't have reflection. The problem with non-member
functions is I can't reflect on a type and loop over its member
functions if some of the functionality is somewhere else.
More information about the Digitalmars-d-announce
mailing list