RFC: reference counted Throwable

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 21 03:58:39 PDT 2014


Am 21.09.2014 10:51, schrieb Jacob Carlborg:
> On 2014-09-20 18:56, Andrei Alexandrescu wrote:
>
>> 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
>
> We do need to know what you're proposal is for. How else can we comment
> on it? Paulo Pinto's comment "It requires compiler support, though"
> suggests, at least to me, he didn't understand you suggested ARC, i.e.
> RC with compiler support.
>

Sorry but I guess I did understand it. There are only four ways of doing 
RC, regardless how you name them.

- programmer writes manually calls to increment/decrement counters, like 
old time Cocoa and COM

- library types which take advantage of operator overloading for 
increment/decrement operations, like *_ptr<>(), ComPtr<>() and RefCounted

- automatic increment/decrement operations via special type or code 
pattern recognition => compiler support like Swift, Objective-C, 
C++/CLI, C++/CLX, Swift, Cedar, Modula-2+

- automatic increment/decrement operations via special type or code 
pattern recognition, followed by code removal of needless call pairs =>
compiler support like Objective-C and Swift

So given Andrei's comment, compiler support is required.

The only thing that distinguishes Apple solution from other ones, is 
that they made a marketing name for a common RC optimization.

--
Paulo


More information about the Digitalmars-d mailing list