<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Michael Van Canneyt via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> schrieb am Fr., 7. Mai 2021, 08:14:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On Fri, 7 May 2021, Sven Barth via fpc-devel wrote:<br>
<br>
><br>
> In my opinion the better solution is to continue the road that Maciej <br>
> started and to implement that "default field" concept together with <br>
> operator hoistening so that records with management operators can be <br>
> used as containers. This is essentially the way it's done in C++ as well <br>
> (e.g. we use that extensively at work), but it needs some questions <br>
> solved for the default field functionality. This way the functionality <br>
> is definitely optional and can be controlled per-instance instead of <br>
> per-type. What it wouldn't solve however would be the assignment <br>
> problems ("wrapped" to non-"wrapped" instance) though that could be <br>
> probably be more or less solved by only allowing an explicit conversion <br>
> to the non-"wrapped" instance.<br>
<br>
I thought it was agreed at the time that this was the most viable way<br>
forward ?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">As far as I remember there wasn't really any agreement. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
IIRC there was also the proposal that this could be done automatically using<br>
a keyword:<br>
<br>
var<br>
SomeClass : TSomeClass; dispose;<br>
<br>
The compiler can internally create the management record with a single default <br>
field and the needed management operator, so the user does not need <br>
to create all that.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I'm not aboard with such a keyword. The compiler should provide the necessary language mechanisms (default field, operator hoisting) and then there should be a default implementation as part of the RTL. There is no need to hide this behind a keyword, attribute or whatever. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I cannot speak for others, but I think 90% of potential use cases for ref counting<br>
would be covered like this in my code: objects that only live inside a<br>
procedure.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I think the same. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>