lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 04/29/2017 06:21 AM, Roberto Ierusalimschy wrote:
> What does it mean for Lua to be "UTF-8 aware"?

>From my point of view there are two topics concerning UTF-8 in Lua:

  * allow UTF in identifiers

    Don't see any long-term profit in it. This does not add any
    power but encourages to write unmaintainable code.

  * introduce UTF-8 strings

    UTF-8 codepoint is variable length, from 1 to 4 bytes.
    So we lose ability of direct addressing character in O(1) time.
    Also we could no longer change any character without shifting
    rest of string tail. So it will be performance degradation.

    But further extending "utf8" standard library with advanced
    coding/encoding UTF-8 routines is not bad.

>From the other hand, by using UTF we may design language with
extended glyphs in syntax. It will eliminate clashes between
"[" (indexing) and "[[" long quote string, "-" unary minus and
"--" comment, and may shrink "<=", "=>", "==" to one glyph.

Problem is how to type UTF glyphs from keyboard? And this will be
another language anyway.

-- Martin