3 ms·
My future perfect programming language will have explicit native types for strings: ansi, utf8, utf16, and unicode. The nth of any array works as expected for
by specialist 6y ago
My future perfect programming language will have explicit native types for strings: ansi, utf8, utf16, and unicode.
The nth of any array works as expected for that type. Convert to bytes as needed.
ansi "abcd"[1] -> byte
utf8 "abcd"[1] -> char
utf16 "abcd"[1] -> char
utf8 "abcd".toBytes()[1] -> byte
unicode "abcd"[1] -> word
Were it still the 90s, I'd probably care about locales, so somehow imbue ansi arrays with that metadata.