fuzion
fuzion copied to clipboard
`Const_String.utf8` leads to unexpected (for new fuzion programmers) behavior
$ cat ex_string_sequence.fz
ex_string_sequence =>
a := "hello, world!"
say "{a.utf8}"
this returns:
$ fz ex_string_sequence.fz
hello, world!
which, to an experienced fuzion programmer, is not a surprise, because Const_String defines the utf8 implementation of itself to be itself, which works because it inherits from array u8. anyone else would be surprised at this, though, and would expect the following result:
[104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33]
I'm aware this might be an inherent drawback with the implementation of String we have, but I just wanted to mention this here.
Thanks to @simonvonhackewitz for making me realize this is a problem.