Enhancement: issue error on all public functions that are missing ddoc sections
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Mar 20 17:17:00 PDT 2015
On 3/19/15 3:03 PM, Walter Bright wrote:
> On 3/19/2015 2:43 AM, deadalnix wrote:
>> Here is what will pass review :
>
> Presumably the reviewers will have some common sense and taste.
>
>> class User {
>> /**
>> * Accessor to get the id of the user.
>> *
>> * @return : the id of the user
>> */
>> uint getUserID() { ... }
>>
>> /**
>> * Accessor to get the name of the user.
>> *
>> * @return : the name of the user
>> */
>> string getName() { ... }
>
> Accessor functions that merely return a field variable are bull anyway.
>
>
>> This is very popular in "enterprise" code, and there is a reason
>> everybody hates
>> it.
>
> I think the problem is more with the desire to have noise wrappers like:
>
> int foo;
> int getFoo() { return foo; }
They're useful to prevent writes to foo. Also as Amaury mentioned they
give the implementer better options going forward. See debacle about
C++'s std::pair's "first" and "second". "Of course they needn't be
functions!" said everybody to the regret of future everybody. -- Andrei
More information about the Digitalmars-d
mailing list