Benchmark of try/catch

Daniel Keep daniel.keep.lists at gmail.com
Mon Mar 23 06:32:03 PDT 2009



bearophile wrote:
> grauzone:
> 
>>From your site:<
> 
> I don't own LiveJournal :-) That's just my blog, my site is elsewhere.
> 
> 
>> Using exceptions in a string->int conversion routine is really horrible and incredibly stupid.<
> 
> I agree that it's not nice looking, but in Python that's the standard idiom.
> In D I do the same thing when I want to know if a string contains an integer or float, with toInt/toFloat, how can I do it with no exceptions?
> 
> Python3 also removes the find() method of strings, and leaves only the index() method, that is like find(), but raise ValueError when the substring is not found. So you are forced to use exceptions here too.
> 
> So far in D I have used exceptions to control flow only once, in this library module (original code idea by Witold Baryluk, modified):
> http://www.fantascienza.net/leonardo/so/dlibs/generators.html
> 
> Bye,
> bearophile

Andrei already solved this problem; I'm just waiting for its
implementation to be possible in D...

http://www.nwcpp.org/Meetings/2006/05.html

:D

  -- Daniel



More information about the Digitalmars-d mailing list