numericValue for (unicode) characters

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Jan 4 05:18:46 PST 2013


04-Jan-2013 15:58, Jonathan M Davis пишет:
> On Thursday, January 03, 2013 20:40:47 monarch_dodra wrote:
>> So... do we agree on
>> ascii: int - not found => -1
>> uni: double - not found => nan
>
> I'm not a fan of the ASCII version returning -1, but I don't really have a
> better suggestion. I suppose that you could throw instead, but I don't know if
> that's a good idea or not. It _would_ be more consistent with our other
> conversion functions however.
>
> - Jonathan M Davis

I find low-level stuff that throws to be overly awkward to deal with 
(not to mention performance problems).

Hm... I've found an brilliant primitive Expected!T that could be of 
great help in error code vs exceptions problem. See the recent Andrei's 
talk that went live not long ago:

http://channel9.msdn.com/Shows/Going+Deep/C-and-Beyond-2012-Andrei-Alexandrescu-Systematic-Error-Handling-in-C

Time to put the analogous stuff into Phobos?

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list