Plan for Exceptions and @nogc?
via Digitalmars-d
digitalmars-d at puremagic.com
Thu Feb 19 03:45:24 PST 2015
On Wednesday, 18 February 2015 at 20:47:36 UTC, deadalnix wrote:
> On Wednesday, 18 February 2015 at 20:25:07 UTC, Dicebot wrote:
>> Right now I don't care for full memory safety or type safety
>> of any proposed solution. I will be glad to have any that
>> actually works - and I have not heard of any idea that allows
>> to do that without language changes. Your push for owned is
>> also hardly relevant because exceptions are good examples of
>> data with shared / non-determenistic ownership and thus won't
>> benefit from it.
>
> I think it make sense to require that something thrown to be
> owned. That means ownership can be transferred from one thread
> to the other. That also mean that the compiler can free the
> exception when it goes out of scope, which is what is wanted
> for exception and @nogc to work together.
>
> The invalid operation in @nogc would become promoting owned to
> Tl/shared/immutable rather than not allocating at all.
>
> This has added benefit to allow for way more code to be @nogc,
> and in many cases transfers the GCness of something in the
> caller, which makes for @nogc compatible libraries that can be
> used in both @nogc and gc situation.
>
> If we are gonna add something in the language, it'd better be
> worth it.
+1
Could you take the time to make a concrete proposal? I'll try to
have another go at `scope`, which is of course deeply linked with
ownership, and these two things need to work well together. I
want to avoid proposing something that will later collide with
your ideas.
More information about the Digitalmars-d
mailing list