<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2018-03-08 4:13 GMT+01:00 Ryan Joseph <span dir="ltr"><<a href="mailto:ryan@thealchemistguild.com" target="_blank">ryan@thealchemistguild.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">1) Given the example below we have a template for a standard ref counted record. Shouldn’t there be some “meta record” type that implements this automatically? I’m thinking about adding this to some types but the idea of recreating this same template every time is daunting and records don’t have inheritance so there’s no way to capture it once.<br></blockquote><div><br></div><div>Management operators are almost unusable without default field/default property. How it works you can see here :</div><div><br></div><div><a href="https://github.com/maciej-izak/PascalSmartPointers">https://github.com/maciej-izak/PascalSmartPointers</a><br></div><div><br></div><div>the examples can be tested with NewPascal for now. The simplified inheritance for records can be simulated by "default field", but the main idea is to use mix of generics/management operators and default field. "default field" has very long list of potential usages. </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">
2) This new feature begs the question why can’t classes be kept on the stack OR the heap now like in c++? There’s countless times I allocate a class on the heap (because you have to) when I could have kept it on the stack and the compiler called some destructor it when it goes out of scope. It’s such a common pattern and a shame to be dynamically allocating/freeing memory every time. C++ really cleans up a lot of memory garbage by making it an option of how your classes are allocated but FPC is stuck in the middle with structs/classes being different enough you need to decide once and commit to that memory management scheme for all uses.</blockquote><div><br></div><div>"ARC" objects are for sure possible to achieve but in other way (by new feature called concepts). Management operators are intended as base for nullable types, smart pointers and can be used for ARC classes too but the real and proper ARC classes should be implemented in other way. In this are is a lot of R&D - you need to remember that the priority is to keep backward compatibility - we don't want Delphi NEXTGEN for all modes - the main advantage of FPC is freedom of choice :)</div></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Best regards,<br>Maciej Izak</div></div></div>
</div></div>