RFC: reference counted Throwable

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 01:32:54 PDT 2014


On Saturday, 20 September 2014 at 08:20:47 UTC, Marc Schütz wrote:
> On Friday, 19 September 2014 at 22:14:08 UTC, Andrei 
> Alexandrescu wrote:
>> On 9/19/14, 12:42 PM, Jacob Carlborg wrote:
>>> On 2014-09-19 17:32, Andrei Alexandrescu wrote:
>>>
>>>> Whenever a reference to a Throwable is copied about, passed 
>>>> to
>>>> functions, the compiler inserts appropriately calls to e.g. 
>>>> incRef and
>>>> decRef. (Compiler may assume they cancel each other for 
>>>> optimization
>>>> purposes.) Implementation of these is up to the runtime 
>>>> library.
>>>
>>> Are you suggesting we implement ARC?
>>
>> Yes. -- Andrei
>
> I don't think ARC is needed.
>
> library RC + borrowing + uniqueness/moving = WIN

You can't do polymorphic entity RC (like exceptions) without at 
least some help from compiler because language currently does not 
provide tools for lifetime control of classes. At least _some_ 
form of ARC is necessary.


More information about the Digitalmars-d mailing list