5 ms·
I don't see a foot gun, you just need to check if you have consumed the whole input. Which is the norm in nearly any streaming api
by jdbdndj 2y ago
I don't see a foot gun, you just need to check if you have consumed the whole input. Which is the norm in nearly any streaming api
- mort96 2y agoIn what way is it streaming? It takes at least the entire numeric string as a string in memory, you can't stream in more data as needed
- randomNumber7 2y agoI didn't see a foot gun either, but somehow my foot went missing.
- deleted 2y ago[deleted]
- pilif 2y agoI 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.