Drawbacks of exceptions being globally allocated
Tejas
notrealemail at gmail.com
Sun Aug 15 02:12:57 UTC 2021
On Sunday, 15 August 2021 at 02:09:08 UTC, Tejas wrote:
> On Sunday, 15 August 2021 at 00:15:32 UTC, Ali Çehreli wrote:
>> On 8/14/21 4:41 AM, Tejas wrote:
>>
>> > [...]
>> exception
>> > [...]
>>
>> So, there would be many exception objects one for each place
>> that an exception can be thrown. Functions like enforce()
>> would have to take a reference to the exception object that is
>> associated with that local scope.
>>
>> [...]
>
> I just want ```@nogc``` exceptions ;_;
>
> Please tell me that the ```GC.stats``` thing I posted is
> irrelevant so that I can go back to using ```emplace```.
>
> I wanted to allocate a class on the heap without being forced
> to use templates... but I guess that simply isn't possible(I
> know I can use ```mixin```, but that's even worse).
In @nogc code, of course, like how for stack allocation there's
simple ```scope c = new C(ctor args...)```, but to allocate on
heap is ```auto c = heapAlloc!(A, ctor args...)```. I wanted to
remove the ```!```
More information about the Digitalmars-d-learn
mailing list