www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - what is the aftermath of dip74

reply Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= <aferust gmail.com> writes:
Do we have any implementation of ref-counted class instances? İf 
not why?
May 10 2023
parent reply "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
We do not, no.

Reference counting is not currently in the language, although you can 
fake it with structs.

Its a huge shame, but it should be added at some point because the 
compiler would tell the backend that it is possible to elide pair calls.

However it'll have to wait for the DIP queue to reopen (slight process 
adjustment to make things easier is incoming).
May 10 2023
parent reply Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= <aferust gmail.com> writes:
On Wednesday, 10 May 2023 at 18:15:36 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
 We do not, no.

 Reference counting is not currently in the language, although 
 you can fake it with structs.

 Its a huge shame, but it should be added at some point because 
 the compiler would tell the backend that it is possible to 
 elide pair calls.

 However it'll have to wait for the DIP queue to reopen (slight 
 process adjustment to make things easier is incoming).
Thank you Rikki for the clarification. I think d need this without ugly workarounds.
May 10 2023
parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 11/05/2023 6:23 AM, Ferhat Kurtulmuş wrote:
 Thank you Rikki for the clarification. I think d need this without ugly 
 workarounds.
Yeah we do. Reference counting is expensive, and modern backends have the capability to elide pairs of calls. So this would be a massive improvement just from the perspective of performance alone.
May 10 2023