RFC: reference counted Throwable

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 01:39:35 PDT 2014


On 9/20/2014 12:17 AM, Ola Fosheim Grostad wrote:
> On Saturday, 20 September 2014 at 06:01:19 UTC, Walter Bright wrote:
>> This doesn't address any of the 3 concerns.
>
> 1. RC efficiency is architecture dependent.

Please show me the efficient assembler for the x86.


> E.g. TSX is coming even if there is
> a bug in lower end CPUs. Suggest making performance oriented prototypes on
> different architectures before concluding.

I'd love to see it.


> 2. As long as you have a RC pointer to an obj on the stack you can switch to
> regular references. No magic involved for the easy case, just semantic analysis.

As soon as you pass a reference to a function, that all goes out the window. 
There's a reason why Rust has invested so much effort in the notion of a 
"borrowed" pointer.


> 3. True, but you can keep the refcount at a negative offset for new-based
> allocations. Besides it only affects those who do @nogc and they should know
> what they are doing.

If this is so simple, why doesn't everyone do it?


More information about the Digitalmars-d mailing list