Proposal 2: Exceptions and @nogc
via Digitalmars-d
digitalmars-d at puremagic.com
Mon Apr 10 17:55:37 PDT 2017
On Tuesday, 11 April 2017 at 00:46:51 UTC, Petar Kirov
[ZombineDev] wrote:
> On Sunday, 9 April 2017 at 03:26:14 UTC, Walter Bright wrote:
>> My previous version did not survive implementation. Here's the
>> revised version. I have submitted it as a DIP, and there's a
>> trial implementation up:
>>
>> [...]
>
> Instead of adding new runtime helper functions like
> _d_newThrowable and _d_delThrowable, can we leverage the
> existing (though deprecated) support for class (de)allocators
> and essentially divide the _d_delThrowable implementation
> between the destructor and the deallocator member function?
> This will go hand in hand with the work that Lucia has been
> doing on making the runtime more generic and reducing the
> number of special cases in the compiler [1] [2] [3]. Obviously
> you have done the work already, but in theory at least, with my
> proposal users should be able to override the memory allocation
> method in derived exception classes, without any changes to
> druntime.
>
> [1]: https://github.com/dlang/druntime/pull/1781
> [2]: https://github.com/dlang/druntime/pull/1792
> [3]: http://dconf.org/2017/talks/cojocaru.html
Apart from that the proposal seems fine to me. I would much
prefer a more general/principled solution to the problem like the
one deadalnix proposes, but that shouldn't stop us from
experimenting with an ad hoc approach in the short-term, while a
more solid solution is developed.
More information about the Digitalmars-d
mailing list