clarity-lang / reference

The Clarity Reference
146 stars 34 forks source link

Concat utf8 and ascii strings #36

Open njordhov opened 3 years ago

njordhov commented 3 years ago

ASCII strings are already valid UTF8: The first 128 characters of Unicode, which correspond one-to-one with ASCII, are encoded using a single byte with the same binary value as ASCII, so that valid ASCII text is valid UTF-8-encoded Unicode as well.

Clarity's concat function can leverage this fact to allow a utf8 strings to be concatenated with ascii strings. It can be implemented independent of making ascii-string a proper subtype of utf8-string as proposed in #35.