<div dir="ltr"><div dir="ltr">On Wed, Jun 19, 2019 at 5:45 PM Ben Grasset <<a href="mailto:operator97@gmail.com">operator97@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Wed, Jun 19, 2019 at 5:02 PM Ryan Joseph <<a href="mailto:genericptr@gmail.com" target="_blank">genericptr@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
It’s used for making reference counted types at the user level.<br></blockquote><div><br></div><div>I'm not sure why you'd necessarily need to implement Copy specifically for that kind of thing, though. Initialize and Finalize would be much more relevant, I'd say.</div></div></div></blockquote><div><br></div><div>Also, either way, the "managed record" overhead really isn't great. Try first un-commenting-out `S: AnsiString` in <a href="https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(j:1,lang:pascal,source:'unit+Output%3B%0A%0A%7B$mode+ObjFPC%7D%0A%7B$modeswitch+AdvancedRecords%7D%0A%7B$ImplicitExceptions+Off%7D%0A%0Ainterface%0A%0Atype+TLetter+%3D+(A,+B,+C)%3B%0A%0Atype+%0A++TRecord+%3D+record%0A++++//S:+AnsiString%3B%0A++++Letter:+TLetter%3B%0A++++class+function+Make(const+ALetter:+TLetter):+TRecord%3B+static%3B+inline%3B%0A++++procedure+Proc%3B+inline%3B%0A++++class+procedure+DoIt(const+A:+array+of+TRecord)%3B+static%3B+%0A++++class+procedure+DoDoIt%3B+static%3B+inline%3B%0A++end%3B%0A%0Aimplementation%0A%0Aclass+function+TRecord.Make(const+ALetter:+TLetter):+TRecord%3B%0Abegin%0A++Result.Letter+:%3D+ALetter%3B%0Aend%3B%0A%0Aprocedure+TRecord.Proc%3B+%0Abegin%0A++WriteLn(%5BB%5D+%3C%3D+%5BA,+B,+C%5D)%3B%0Aend%3B%0A%0Aclass+procedure+TRecord.DoIt(const+A:+array+of+TRecord)%3B+%0Avar+Start,+Finish:+%5ETRecord%3B%0Abegin%0A++Start+:%3D+@A%5B0%5D%3B%0A++Finish+:%3D+@A%5BHigh(A)%5D%3B%0A++while+Start+%3C%3D+Finish+do+begin%0A++++Start%5E.Proc()%3B%0A++++Inc(Start)%3B%0A++end%3B%0Aend%3B%0A%0Aclass+procedure+TRecord.DoDoIt%3B+%0Abegin%0A++DoIt(%5BTRecord.Make(A),+TRecord.Make(B),+TRecord.Make(C)%5D)%3B%0Aend%3B%0A%0Aend.'),l:'5',n:'0',o:'Pascal+source+%231',t:'0')),k:57.25490196078431,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:fpc304,filters:(b:'0',binary:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'1',trim:'0'),lang:pascal,libs:!(),options:'-Ci-+-Cr-+-g-+-CX+-XXs+-O4',source:1),l:'5',n:'0',o:'x86-64+fpc+3.0.4+(Editor+%231,+Compiler+%231)+Pascal',t:'0')),k:42.74509803921569,l:'4',n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4">this Compiler Explorer example</a>, and then afterwards re-commenting-out `{$ImplicitExceptions Off}`.</div></div></div>