[phobos] Why ConvError and not ConvException?
David Simcha
dsimcha at gmail.com
Mon Nov 15 19:55:25 PST 2010
Reminder: We're supposed to be at least somewhat stable now. If anyone
commits these changes, please put an alias to the old name in std.conv,
and deprecate it in a few releases. While I agree that this is the
right decision in the long run, it will break code for me and probably
several other people. The alias will mitigate this.
On 11/15/2010 10:44 PM, Andrei Alexandrescu wrote:
> Historical reasons. I favor your implied change.
>
> Andrei
>
> On 11/15/10 7:43 PM, Jonathan M Davis wrote:
>> Why is ConvError in std.conv (which is used for to!() on conversion
>> failure) an
>> Error rather than an Exception? I would have expected it to be an
>> Exception. And
>> the fact that it's an Error makes it so that you can't cleanly call
>> to!() and
>> catch an exception on failure and then deal with the fact that it
>> failed. For
>> instance, if it wer an Exception and you had an string which was
>> supposedly an
>> enum value for the enum MyEnum, you could do to!MyEnum(str), catch
>> the Exception
>> on failure, and do whatever was appropriate given that it's not a
>> valid MyEnum.
>> But with it being an Error, you can't do that (unless you're willing
>> to catch an
>> Error which is not supposed to be done). Am I missing something here?
>>
>> - Jonathan M Davis
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
More information about the phobos
mailing list