News for hackers. Stuff that matters.
Re:How UTF-8 Works by BiteCode_dev on Wednesday February 09, 2022 @09:01AM (#30272686)
How does the type system knows the bytes are utf8 and not CP850?
Re:How UTF-8 Works by morelisp on Wednesday February 09, 2022 @11:39AM (#30274715)
The same way you can parse a string into an integer and it knows you got an either[integer, err].
Re:How UTF-8 Works by BiteCode_dev on Wednesday February 09, 2022 @12:04PM (#30275008)
So it doesn't, and it's not about the type system. Any decode operation in python 3 raise an exception or return string.

It's about the runtime error handling making it mandatory to deal with the error and won't let you panic at run time for this specific error.

Re:How UTF-8 Works by morelisp on Wednesday February 09, 2022 @12:07PM (#30275050)
I'm sorry you don't see exceptions as part of a type system yet.