<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Mar 19, 2015 at 3:03 PM, Walter Bright via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Accessor functions that merely return a field variable are bull anyway.<br></blockquote><div><br></div><div>I would recommend against opening up this debate.  Suffice it to say that this is a well established pattern that many people use; there is well-trod ground arguing both sides.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">    int foo;<br>
    int getFoo() { return foo; }<br>
</blockquote></div><br></div><div class="gmail_extra">A valid reason for doing things like this is future-proof encapsulation.  You can change the internal foo to be something entirely different, and the external api never changes (assuming 'foo' is private).</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">As for the documentation - yeah, don't write docs that duplicate what is there in the method signature.  In the above example, documentation should explain what foo actually is, and why you might need it.  Otherwise is just duplicate boilerplate that should be generated by the doc generator.</div><div class="gmail_extra"><br></div></div>