On 2011-03-14 06:45, ZY Zhou wrote:
it doesn't make sense to add try/catch every time you use
tolower/toupper/foreach
on string. No one will do that.
You either throw exception when convert invalid utf8 bytes to string, or never
throw exception and use invalid UTF32 code in dchar to represent invalid utf8
code.
string s = "\x0A"; // this is the right place to throw the exception (or
compile
error)
s.tolower; // no one will add try/catch on this
--ZY Zhou
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article
On 3/13/11 1:55 PM, Jacob Carlborg wrote:
I would say that the functions should NOT crash but instead throw an
exception. Then the developer can choose what to do when there's an
invalid unicode character.
Yah. In addition, the exception should provide index information such
that an application can elect to continue processing.
Andrei
Depending on what kind of application you write, all you need could just
be to wrap the main method in try/catch.
--
/Jacob Carlborg