June 2022
Intermediate to advanced
130 pages
2h 45m
English
The process of making code safe for multiple languages at once is internationalization. If you’re familiar with it, you know that every single character in a string is called a code point. In Elixir, a code point is represented with a number. Here’s how it works:
| | iex(18)> ?a |
| | 97 |
If this were the only surprising behavior, I’d probably let you read about it yourself, but there’s a strange remnant from Elixir’s dependence on Erlang. Namely, Elixir can’t always tell the difference between lists of numbers and character lists!
Here’s what I mean:
| | iex(22)> [99, 97, 116] |
| | 'cat' |
This happens because Erlang can’t tell the difference between a list of integers and a list of characters, so it guesses. Sometimes these lists ...
Read now
Unlock full access