News for hackers. Stuff that matters.
Re:Elixir Design Goals (2013) by ivoras on Friday December 23, 2016 @09:39PM (#13248290)
Hmmm, the tutorial seems to suggest its strings are linked lists of characters. Is that true?
Re:Elixir Design Goals (2013) by _asummers on Friday December 23, 2016 @09:52PM (#13248328)
You have two -- charlists like you're describing, which are just linked lists of characters under the hood and UTF-8 binaries. Charlists are denoted with single quotes and the UTF-8 ones are denoted with double quotes. Truthfully, I reach for the UTF-8 ones most of the time, but you can get some good performance gains in e.g. template string building in web frameworks if you use charlists. In Erlang, all the strings work like charlists FWIU, so they need to exist at least in some capacity for interop reasons.

http://elixir-lang.org/getting-started/binaries-strings-and-...

Re:Elixir Design Goals (2013) by anuragsoni on Friday December 23, 2016 @09:56PM (#13248343)
Are you thinking of IO lists[0] when you talk about templates with respect to web frameworks?

[0] https://www.bignerdranch.com/blog/elixir-and-io-lists-part-2...

Re:Elixir Design Goals (2013) by _asummers on Friday December 23, 2016 @09:59PM (#13248351)
I totally am and now I look silly :) Good catch.
Re:Elixir Design Goals (2013) by anuragsoni on Friday December 23, 2016 @10:01PM (#13248357)
Not at all :) If you haven't read that post by bignerdranch, i'd definitely recommend it. It was interesting read (both parts 1 and 2)
Re:Elixir Design Goals (2013) by yellowapple on Saturday December 24, 2016 @12:13AM (#13248683)
If you want them to be, yes.

Erlang's normal "string" type is indeed a list of integers representing codepoints. Erlang also supports "bitstrings" or "binary strings", which are basically what most other languages would just call "strings", as a logical extension of its existing binary data syntax.

Elixir instead uses Erlang "bitstrings" as its default "string" type. Erlang integer-list-based "strings" are represented in Elixir by using single-quotes instead of double-quotes around such a string (or by just manipulating a list directly; Elixir will transparently convert a list of integers into an Erlang-style charlist if the integers are valid codepoints).

Re:Elixir Design Goals (2013) by TylerE on Friday December 23, 2016 @09:54PM (#13248337)
Linked list strings are not necessarily terrible in a language with immutable data like Elixir.
Re:Elixir Design Goals (2013) by qaq on Friday December 23, 2016 @09:47PM (#13248309)
those exist for compatibility with Erlang. Elixir strings are UTF-8 encoded binaries.
Re:Elixir Design Goals (2013) by querulous on Saturday December 24, 2016 @02:06AM (#13248959)
erlang 'strings' are utf-8 encoded binaries also, they just have slightly terrible syntax
Re:Elixir Design Goals (2013) by jeremyjh on Saturday December 24, 2016 @09:03AM (#13249785)
This is incorrect. In erlang the binary type is like a blob or byte array. Strings are linked lists of individual code points. Elixir encodes strings in erlang binaries.
Re:Elixir Design Goals (2013) by angersock on Saturday December 24, 2016 @03:15AM (#13249071)
Not the lists of integers that happen to be characters.