--- Comment #4 from bearophile_h...@eml.cc 2011-10-23 12:46:46 PDT ---
(In reply to comment #3)
> They're similar but not the same. Bug# 6840 is suggesting the creation of a
> template which wraps whether std.conv.to succeeds by catching the exception.
> This is highly inefficient and ends up creating a new type in the deal, which
> is messier IMHO.
> What I'm suggesting here is that a new function be created which doesn't risk
> ConvException being thrown at all, completely avoiding the huge inefficiency
> catching the thrown exception.
You have missed this part of that bug 6840:
> 2) This simple implementation of maybeTo contains a try-catch, but there is no
> need to actually throw and catch an exception in all wrong conversion cases.
> Example: when Tin is string and Tout is int, maybeTo is free to use something
> lighter, like a C function that produces no exceptions, instead of to!(). I
> think this allows the compiler to perform some extra optimizations.
If you create a conversion function that doesn't throw, then it is useful to
create a maybeTo :-)
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------