Bitstring and binary

Thanks @jaysoifer! I also wrote some blog posts covering some of the talk topics in a little more depth:

@kostonstyle The way I phrased this distinction was:

In Elixir, a “bitstring” is anything between << and >> markers, and it contains a contiguous series of bits in memory. If there happen to be 8 of those bits, or 16, or any other number divisible by 8, we call that bitstring a “binary” - a series of bytes. And if those bytes are valid UTF-8, we call that binary a “string”.

So a subset of bitstrings are binaries, and a subset of binaries are strings. Like this:

If you don’t understand what it means for something to be “UTF-8 encoded”, the first blog post should help.

18 Likes