[erlang-questions] Erlang basic doubts about String, message passing and context switching overhead
Sat Jan 14 20:56:00 CET 2017
On 14 Jan 2017, 17:00 +0100, Ilya Khaprov <>, wrote:
> >> Given that both Erlang and elixir are implemented on top of BEAM, the wheel might not need reinventing?
> Why Elixir implements Unicode in Elixir? You have to rewrite it anyway.
Elixir takes the files directly from unicode distribution, and uses macros to compile them down into regular functions. BEAM is wonderful at optimising bitstring pattern matching, so the resulting code is quite efficient and does not need NIFs. The whole implementation is also about 500 LoC https://github.com/elixir-lang/elixir/blob/master/lib/elixir/unicode/unicode.ex, so it's not a monstrosity and the code is quite readable.
On 14 Jan 2017, 16:53 +0100, Oliver Korpilla <>, wrote:
> Could the Unicode support in elixir serve as a starting point?
> String.upcase/1 and String.downcase/1 seem to be Unicode-aware. And a lot of effort seems have gone in scenarios like this:
> "For example, the codepoint “é” is two bytes:
> iex> byte_size("é")
> Given that both Erlang and elixir are implemented on top of BEAM, the wheel might not need reinventing? I know engineers and programmers love inventing stuff, and this discussion seems to point in that direction, but...
All the functions in the Elixir's String module are unicode aware. There are functions for unicode normalisation (both nfd and nfc) and checking equivalency (e.g. "é" can be a single code point, or two code points - the letter "e" and the combining diacritic acute). String.length/1 works in terms of unicode graphemes (multiple codepoints can compose into a single grapheme):
On 14 Jan 2017, 16:30 +0100, Benoit Chesneau <>, wrote:
> someone has to write a good binding (non blocking) of icu :) I think it would be easier than reinventing the wheel. i18n  was a good start but looks abandoned these days. Also I disliked the load of resources at startup in ETS: https://github.com/erlang-unicode/i18n
icu is problematic in the fact that it works mostly with UTF-16.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions