List of Phobos functions that allocate memory?
Brad Anderson
eco at gnuk.net
Thu Feb 6 14:27:15 PST 2014
On Thursday, 6 February 2014 at 22:19:42 UTC, Dicebot wrote:
> On Thursday, 6 February 2014 at 22:15:11 UTC, Brad Anderson
> wrote:
>> 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.
>
> I agree. It kills the whole concept of "exceptions are rare so
> they don't need to be fast when thrown". But it is how quite
> lot of Phobos is currently designed and, in my opinion, is
> biggest design mistake of vibe.d too (it uses exceptions to
> propagate HTTP status codes)
I must admit that I am guilty of sometimes using exceptions for
routine control flow too. It's just so convenient compared to
validation/consumption.
Maybe we should make a list of Phobos functions that throw
exceptions and ensure that (for the ones where this makes sense)
they non-throwing validators available. If we can stop gc
allocating them that'd be even better but I don't think them
being gc allocating should hold up @nogc.
More information about the Digitalmars-d
mailing list