On Thursday, 6 February 2014 at 21:38:03 UTC, Dicebot wrote:
On Thursday, 6 February 2014 at 19:08:40 UTC, Adam D. Ruppe wrote:
On Thursday, 6 February 2014 at 18:52:21 UTC, fra wrote:
Hey, wait a second. How do you throw without allocating?

I think exceptions should be ok. You optimize the typical path, and exceptions are (by definition) an exceptional path. If they are also unacceptable, you could restrict yourself to nothrow functions. (Which can still throw Errors... but meh they are even *more* exceptional)

Hardly so. Any exception allocation can trigger GC collection cycle and Phobos does not provide any other way to handle data errors. Any application that operates on some external user input will be subject to DoS attack vector if it uses Phobos directly.

It was huge performance killer for vibe.d last time I have checked, for example.

Personally I don't think bad user input qualifies as an exceptional case because it's expected to happen and the program is expected to handle it (and let the user know) when it does. That's just a matter of taste though.

Reply via email to