[phobos] Drought of functions that throw exceptions
dclugston at gmail.com
Thu Nov 1 08:42:28 UTC 2018
Absolutely there is a reason. Exceptions are very expensive, especially in
low-level functions. In the situation you're talking about, it's a simple
logic error in the calling code. That situation will never happen in
This is very different from the situation with something like a file
operation where "disk full" is a genuine exceptional situation.
On Thu, 1 Nov 2018 at 09:02, Richard Palme via phobos <phobos at puremagic.com>
> Is there a reason why so few functions in phobos throw
> exceptions? For example there is std.bitmanip.BitArray.flip that
> gets an index as argument and flips the bit that the index
> references, and this function does not throw an exception when
> given an invalid argument.
> I'd be willing to fix this, but first I wanted to ask if there
> might be a reason for this. I think that throwing an exception
> should be preferable to a segmentation fault (which happens in
> the case of BitArray.flip).
> phobos mailing list
> phobos at puremagic.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the phobos