3 ms·
One reason not to use Elixir is the absence of vectors/arrays. Yes, you can import them from Erlang but they ain't pretty. Elixirists try to pretend that lists
by cutler 9y ago
One reason not to use Elixir is the absence of vectors/arrays. Yes, you can import them from Erlang but they ain't pretty. Elixirists try to pretend that lists and tuples are all you need but Elixir's lists are Lispy lists, not the Python variety. It's one of these small print things you only discover after spending time with Elixir but it can be a deal-breaker. Ask on the Elixir lists and you'll get some very defensive responses which basically add-up to vectors/arrays being difficult to optimise in a dynamic functional language. String processing is also not quite as straightforward as in Ruby and Python due to how Erlang/Elixir uses binary representation.
- paulcsmith 9y agoCan you explain a bit more what you mean? What advantages do "Python variety" lists give you over what Elixir does with lists and tuples?
- cutler 9y agoPython's lists are really arrays/vectors as in Ruby ie. well-optimised for index-based access. Erlang/Elixir lists are linked lists which are more optimised for appends than index-based access though you can achieve the same with Enum.at(list, index). With small lists/arrays the difference isn't noticeable but it will affect performance with large lists.
- bousaid 9y agoArrays and vectors are different. I’d suggest adhering to C-like conventions of data structures.
- dnautics 9y agoIf we're being honest, Python lists aren't arrays either, they are arrays of pointers which need to be unboxed before using. If you really really need array performance, then drop down to c, or use a language like Julia. Lists give you the ability to quickly pass these structures as immutable objects, which in turn, you want because of safety guarantees in concurrent environments.
- elcritch 9y agoThe lack of true arrays or vectors haven’t been an issue for me across a couple of domains. Of course maps can always be used as indexed based lookups for mid-sized problems (similar to lua’s combined array/map type). What problems have you been facing where it’s an issue? It’d be nice to know to avoid said problems upfront.
- tbrooks 9y agoYou've brought this up before. [0] [0] https://news.ycombinator.com/item?id=12013088 https://news.ycombinator.com/item?id=12013088
- tomcam 9y agoIs there a limit to the number of times one can state the same opinion on HN?
- jondubois 9y agoI never bought into the pure functional programming hype. Most programs are made up of many functions and as the program gets more complex, the code paths keep getting longer... If you force everything to always be passed by value and returned by value (never by reference) it's clear that the costs of constantly cloning all these objects would quickly add up. The problem with pure functional programming is that it prevents the developer from writing well optimized code. State change side effects might be dangerous, but they're also a really good way to boost performance and sometimes they're totally worth it.
- ramchip 9y ago> If you force everything to always be passed by value and returned by value (never by reference) it's clear that the costs of constantly cloning all these objects would quickly add up. That’s not what happens. See: http://erlang.org/pipermail/erlang-questions/2013-March/072760.html http://erlang.org/pipermail/erlang-questions/2013-March/0727... “Pass by value does NOT imply copying and never has; copying is only required for mutable data structures, and Erlang hasn't any.”
- cutler 9y agoSee Rich Hickey's description of structural sharing in Clojure. Persistent data structures are not simple copies.