RFC: reference counted Throwable

Mike via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 20:28:02 PDT 2014


On Saturday, 20 September 2014 at 16:56:32 UTC, Andrei 
Alexandrescu wrote:
> On 9/20/14, 8:08 AM, Jacob Carlborg wrote:
>> On 2014-09-20 16:33, Paulo Pinto wrote:
>>
>>> It requires compiler support, though.
>>
>> The first thing I asked in this thread was "Are you suggesting 
>> we
>> implement ARC?" and the answer was "Yes" [1]. So it looks like 
>> Andrei
>> already wants to implement ARC. My definition of ARC is that 
>> the
>> compiler inserts the calls to retain/release (or whatever you 
>> call them).
>>
>> [1]
>> http://forum.dlang.org/thread/lvhiam$1pno$1@digitalmars.com#post-lvi0ve:2429il:241:40digitalmars.com
>
> Please don't take me in a court of law. But yes, I am talking 
> about the compiler inserting calls to increment and decrement 
> reference counts. -- Andrei

I suggest the compiler insert calls to whatever "lifetime events" 
may cause an increment/decrement.  Then, the druntime can provide 
the implementation.

I believe with these runtime hooks in place platform-specific 
optimizations and even alternative memory managers can be 
experimented with.

I refer you to an enlightening quote I once found on a raytracing 
site that really captures the beauty of software:
"You know you've been raytracing too long when you've been asked 
how you did that thing you did by the author of the raytracer you 
used to do it."

Just build the capability, and let the community surprise you 
with their ingenuity.

Mike


More information about the Digitalmars-d mailing list