zlacker

[parent] [thread] 2 comments
1. maxdam+(OP)[view] [source] 2025-08-22 16:34:40
Do you want grep to crash when your text file turned out to have a partially written character in it? 99.999% seems very high, and you haven't given an actual use case for the restriction.
replies(2): >>gf000+ca >>empath+Ca
2. gf000+ca[view] [source] 2025-08-22 17:26:12
>>maxdam+(OP)
Crash? No. But I can safely handle the error where it happens, because the language actually helps me with this situation by returning a proper Result type. So I have to explicitly check which "variant" I have, instead of forgetting to call the validate function in case of go.
3. empath+Ca[view] [source] 2025-08-22 17:28:32
>>maxdam+(OP)
Rust doesn't crash when it gets an error unless you tell it to. You make a choice how to handle the error because you have to it or it won't compile. If you don't care about losing information when reading a file, you can use the lossy function that gracefully handles invalid bytes.
[go to top]