Hacker News new | ask | show | jobs
by pilif 612 days ago
I get that this is a super low level API, but yet, my expectation about an API that parses a buffer with length to a number and which has a specific enum for error cases as its return type would be that when asked to parse "9not a number" that I would get an error response and not a "the number you asked me to parse is 9 and everything went well" as the result.

The whole reason for returning a result enum would be so I don't forget to also check somewhere else whether something could possibly have gone wrong.

Especially when there is a specific result type.

1 comments

But now you need a different API to compute where a number starts and end and that API must use exactly the same definition of number.
There could be an enum value for "read a partial number"