You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes people say that exceptions should only be raised for unexpected states in the program, but that a nonmatching parse is often an expected state so it should just return a sentinel value instead of raising an error. What do you think?
The text was updated successfully, but these errors were encountered:
I agree. The parse method throws an error to match behaviour of Base.parse(Int,"abc"). Please refer to tryparse instead, that returns nothing if there is no match.
Yet your question makes me wonder whether instead returning NoMatch() singleton would be clearer as nothing might be a intended parsing result. What do you think?
I agree returning NoMatch() would be less ambiguous in cases where nothing is a valid parse result. I suppose theoretically NoMatch() could be an intended parsing result, in which case tryparse could take a sentinel argument.
Sometimes people say that exceptions should only be raised for unexpected states in the program, but that a nonmatching parse is often an expected state so it should just return a sentinel value instead of raising an error. What do you think?
The text was updated successfully, but these errors were encountered: