<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">2017-01-19 10:44 GMT+01:00 Michael Van Canneyt <span dir="ltr"><<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>></span>:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
At the risk of writing nonsense:<br></blockquote><div><br></div><div>Seems ok to me :)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I would think that a method name should give a clue as to what it actually does.<br>
In that sense AddRef/Clone seems better to me ?<br>
(unless Copy does something else besides increasing the ref count ?)<br>
<br>
AddRef is clear to anyone, I think.<br>
<br>
If I see "Clone", I immediatly think of an object whose properties are a copy of<br>
the original, but which otherwise has nothing to do with the original.</blockquote></div><div class="gmail_extra"><br></div>current "Clone" works like expected:</div><div class="gmail_extra"><br></div><div class="gmail_extra">(1) <a href="https://github.com/maciej-izak/PascalSmartPointers/blob/1ecf773128b523a328a11f30a9b766858ac57c99/sources/SmartObj.pas#L63-L77">https://github.com/maciej-izak/PascalSmartPointers/blob/1ecf773128b523a328a11f30a9b766858ac57c99/sources/SmartObj.pas#L63-L77</a></div><div class="gmail_extra">(2) <a href="https://github.com/maciej-izak/PascalSmartPointers/blob/1ecf773128b523a328a11f30a9b766858ac57c99/sources/SmartPtr.pas#L62-L76">https://github.com/maciej-izak/PascalSmartPointers/blob/1ecf773128b523a328a11f30a9b766858ac57c99/sources/SmartPtr.pas#L62-L76</a></div><div class="gmail_extra"><br></div><div class="gmail_extra">"Copy" in (1) and (2) looks somehow strange for me. But for example for Nullable type, convention proposed by Florian is not bad:</div><div class="gmail_extra"><br></div><div class="gmail_extra">(3) <a href="https://github.com/maciej-izak/PascalSmartPointers/blob/1ecf773128b523a328a11f30a9b766858ac57c99/sources/Nullable.pas#L115-L143">https://github.com/maciej-izak/PascalSmartPointers/blob/1ecf773128b523a328a11f30a9b766858ac57c99/sources/Nullable.pas#L115-L143</a></div><div class="gmail_extra"><br></div><div class="gmail_extra">"Clone" seems like right move for all examples. But together with "Copy" IMO is crappy. AddRef in (3) is not correct at all but for (1) and (2) is perfect.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Maybe I thinking too much by RTL and Copy/Clone is not that bad? Anyway is hard for me to ignore RTL... </div><div class="gmail_extra"><br></div><div class="gmail_extra">Copy operator with single parameter seems for me really strange. When I starting any of new code for management operators my first declaration looks like:</div><div class="gmail_extra"><br></div><div class="gmail_extra">class operator Copy(constref Src: T; var Dest: T); // >.< meh...</div><div class="gmail_extra"></div><div class="gmail_extra"><br></div><div class="gmail_extra">TLTR:</div><div class="gmail_extra">Clone might stay as-is but what with "class operator Copy(var Rec: TNullable<T>);"? AddRef for example (3) might be bad idea. Current pair Copy/Clone operators is used in different context for different ideas. At the end RTL naming convention (AddRef/Copy) might be not bad...</div><div class="gmail_extra"><br></div><div class="gmail_extra">-- <br><div class="gmail_signature"><div dir="ltr"><div>Best regards,<br>Maciej Izak</div></div></div>
</div></div>