6 ms·
Elixir Design Goals (2013)
- microcolonel 10y agoElixir is pretty O.K., I use it at work and the restrictions typically have me writing cleaner code.
- deleted 10y ago[deleted]
- ivoras 10y agoHmmm, the tutorial seems to suggest its strings are linked lists of characters. Is that true?
- qaq 10y agothose exist for compatibility with Erlang. Elixir strings are UTF-8 encoded binaries.
- querulous 10y agoerlang 'strings' are utf-8 encoded binaries also, they just have slightly terrible syntax
- _asummers 10y agoYou 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-char-lists.html http://elixir-lang.org/getting-started/binaries-strings-and-...
- anuragsoni 10y agoAre 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-io-lists-in-phoenix/ https://www.bignerdranch.com/blog/elixir-and-io-lists-part-2...
- _asummers 10y agoI totally am and now I look silly :) Good catch.
- anuragsoni 10y agoNot 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)
- TylerE 10y agoLinked list strings are not necessarily terrible in a language with immutable data like Elixir.
- yellowapple 10y agoIf 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).
- macintux 10y agoThe restrictions are what I really appreciate about functional programming, and why I find slapping FP features on top of OO or imperative languages not particularly compelling.
- aczerepinski 10y agoIn my experience Elixir's pattern matching in particular leans to very clean looking code. Type checking sort of conditionals that would be 3 lines in JavaScript are just enforced in the arguments in Elixir for example.
- _nato_ 10y agoFrom an Erlang/OTP vantage point, what Elixir ended up being famed for is its relatively good tooling.
- pfraze 10y agoThat's interesting, why?
- iagooar 10y agoBecause Elixir is a modern programming language that ships with out-of-the box tooling for dependency management, project management, deployment, and so on. This is something to be observed in any relatively new programming language: Elixir, Rust, Go, Swift. They all ship with solid tooling that allows programmers to be more productive from the very beginning without having to figure out the whole build chain themselves.
- pselbert 10y agoThere is a fantastic talk by Fred Herbert (of Heroku and Learn You Some Erlang fame) that discusses this exact situation in the Erlang community [0]. Without an accessible ecosystem, useful tooling, a powerful packaging system, or a community sensitive to newcomers what do you have? Erlang is an amazing platform with a community full of very experienced and wisened developers–but elixir widened the appeal. [0] https://m.youtube.com/watch?v=Z28SDd9bXcE https://m.youtube.com/watch?v=Z28SDd9bXcE
- bitwalker 10y agoThat's what initially attracted me to Elixir instead of Erlang, though the tooling has definitely improved in Erlang with the introduction of rebar3. The integration of testing and documentation (i.e. doctests) is still better than any other language I've worked with. The documentation generator (ex_doc) is excellent too.
- iagooar 10y agoOnce you scratch the surface and get to the functional core, you will never want to go back to object-oriented programming. Maybe it's just me, but since I have tried functional programming, I have never felt the need to go back to OO. Can't say the same about OO, whenever I'm doing it, I kind of tend to design my code as functional as possible. Elixir has it all (well, almost). It's fast, it's compiled AND interpreted, it has a REPL, it has strong concurrency, reliability and scability backed into the VM. It has a simple and beautiful syntax. It has great tooling and is very well documented. The only thing you might miss is static typing. I've been looking for my next programming language of choice after Ruby for almost 2 years now. Clojure was the closest I got to replacing Ruby, but now with Elixir it's just such an obvious choice. If you haven't tried Elixir yet, PLEASE go and do it right now, you won't ever regret it.
- junke 10y agoIs Erlang Object-Oriented? https://www.infoq.com/interviews/johnson-armstrong-oop https://www.infoq.com/interviews/johnson-armstrong-oop Then, my thesis supervisor said "But you're wrong, Erlang is extremely object oriented". He said object oriented languages aren't object oriented. I might think, though I'm not quite sure if I believe this or not, but Erlang might be the only object oriented language because the 3 tenets of object oriented programming are that it's based on message passing, that you have isolation between objects and have polymorphism. Though I must said I am pretty happy with CLOS (Common Lisp Object System), in particular its generic functions.
- dozzie 10y ago> Elixir has it all (well, almost). It's fast, it's [...] Dude, Elixir compiles to BEAM, it's slow as hell. Have you ever compared its processing speed with virtually anything else? It's not processing speed that Erlang is sold about.
- qaq 10y agoSlow as hell is a very scientific measurement :) Processing speed for what workload on what hardware? You do realise there are a lot of workloads that need to be optimised for latency? If we take web dev. Phoenix based solutions are about on par with one's based on a typical Go framework like Gin and are significantly faster than something using PHP, Ruby, Node, Python based web frameworks for a real world workload.
- tony612 10y agoI just wonder what's it's design goals in the future. I noticed that Elixir team seems working hard on something like GenStage and so on.