Plan for Exceptions and @nogc?
Tobias Pankrath via Digitalmars-d
digitalmars-d at puremagic.com
Tue Feb 17 01:19:54 PST 2015
On Tuesday, 17 February 2015 at 07:24:43 UTC, Jonathan Marler
wrote:
>
> Relaxing the definition of @nogc to exclude exceptions could be
> an acceptable compromise. However, the nature of an exception
> is that it is allocated when it is created, and deallocated
> after it is caught. This model fits nicely with scope
> semantics. The code catching the exception would catch a
> "scoped" reference which means it would be responsible for
> cleaning up the exception. It would still be allocated on the
> heap, but it wouldn't be GC memory. This is how I think
> exceptions should have been implemented in the first place, but
> back then the GC wasn't a big deal and scope didn't exist yet.
This actually puts scope on the head. It's unique / ownership
you're looking for (if at all).
More information about the Digitalmars-d
mailing list