Truly @nogc Exceptions?
Paolo Invernizzi
paolo.invernizzi at gmail.com
Sat Oct 20 13:48:32 UTC 2018
On Thursday, 20 September 2018 at 17:14:12 UTC, Steven
Schveighoffer wrote:
> On 9/20/18 12:24 PM, Adam D. Ruppe wrote:
>> On Thursday, 20 September 2018 at 15:52:03 UTC, Steven
>> Schveighoffer wrote:
>>> I needed to know what the slice parameters that were failing
>>> were.
>>
>> Aye. Note that RangeError is called by the compiler though, so
>> you gotta patch dmd to make it pass the arguments to it for
>> index. Ugh. I did a PR for this once but it got shot down
>> because of an allegeded (without evidence btw) performance
>> degradation. Ugh.
>
> Well, you can always override that. Just do the check yourself
> and throw the error you want ;)
>
> In my case, that's what I did anyway.
>
> I don't know how a performance problem can occur on an error
> being thrown anyway -- the process is about to end.
>
> -Steve
If `@nogc` could be relaxed for `new Error` exactly for that
reason, pieces of Phobos could be turned `@nogc`...
But I admit that that change would be controversial...
- Paolo
More information about the Digitalmars-d
mailing list