5 ms·
I've been doing programming for a while now (mostly in Ruby of late, but prior to that, lots of stuff) and the more I play with Elixir, the more I want to work
by lectrick 11y ago
I've been doing programming for a while now (mostly in Ruby of late, but prior to that, lots of stuff) and the more I play with Elixir, the more I want to work in it. I'm actually going to ElixirConf (which is next weekend in Austin).
They seem to have done a lot of things right, and addressed pretty much every single criticism I had of Ruby.
> I'm very seriously considering Elixir/Phoenix for my next startup
It will be a risk, but I say go for it. Others (who have probably NOT had any Elixir experience!!) will tell you your startup is already enough risk, but here's the thing- Elixir could end up being the key differentiator technology for you. Who else provides NO DOWNTIME code upgrades, and that incredible request responsiveness as well as reliability? Immutable data? Extreme concurrency? The "Actor model" that everyone is enamored with these days? The awesome community? Nobody, I think.
- 15155 11y ago> NO DOWNTIME code upgrades This doesn't need to be a language feature, but this is possible on the JVM afaik (see Clojure). Also, NO DOWNTIME in the context of services is kind of hard to qualify: I have no downtime for say, a web service, when doing a load-balancer deploy shuffle. > incredible request responsiveness as well as reliability "Request responsiveness" to some degree depends on language- a language is sometimes your upper-bound on performance. Much more often, however, do I find that this is a function of application design. And yes, language design and application design heavily play into each other, but there are many, many languages that can achieve the same responsiveness/reliability concerns. Haskell, many JVM-hosted languages are good choices. > Immutable data Almost every modern functional language. Many even do it (immutable data structures) better than Erlang/Elixir. Some even have interesting (state of the art) concurrency features that perform better in different situations - see Haskell STM (I wouldn't try and compare to Mnesia). > Extreme concurrency Haskell, Go, anything on the JVM, the CLR is catching up. > Actor model This is a bit of a subjective and semantic thing - many languages have green threads (though not all would necessarily fit the bill of "actor model" in out-of-the-box implementation, and not all are truly preemptive (most aren't)) - Haskell, Go are two good out-of-the-box implementations. I know Haskell has an Erlang Actor analogue, not sure if Go does yet. > The awesome community I hesitate to use the word "niche language" - but most "niche languages" have great communities (albeit small ones) - possibly out of necessity. I don't find that this scales often (What would you call the "Java community?", where would you find it?, where are the pockets of "good?") This is 100% subjective, but, I feel like Ruby has one of the best, largest communities. Some of that has bled into Elixir, for sure, to be fair. --- All in all, Elixir is a great language, but I hesitate to recommend it without knowing more about GP's requirements and business. (What if the GP needs to do very memory and CPU-intensive number crunching?)
- _pmf_ 11y ago> This doesn't need to be a language feature, but this is possible on the JVM afaik (see Clojure). You don't need Clojure; Hot Code Replacement was added in Java 1.4 (yes, that's 2002) and has been supported by application containers as well as IDEs since then.
- 15155 11y agoGood call - I am not as familiar with JVM-hosted languages, though I knew Clojure was capable of hot code replacement (as any lisp should be!) This is definitely not a new idea.
- lobster_johnson 11y agoIsn't Java's HCR very limited? You can't introduce incompatible classes, for example.
- alxndr 11y agoI've heard that putting together Erlang/Elixir releases isn't trivial; how would that compare?
- lobster_johnson 11y agoNever done it. But I don't think anyone claims you get hot code replacement for free. You have to plan and design your app to support it. That said, it's actually intended for downtime-less upgrades, whereas Java's HCR seems intended for debugging and development.
- alxndr 11y agoAh, that's a pretty significant distinction.
- lobster_johnson 11y agoYou can nitpick like this about just about anything — "Erlang has immutable data? Yes, but so does Haskell etc.". That's missing the point that Erlang/OTP (and therefore also Elixir) is attractive because it's already a complete package. It's the intersection of a lot of different, neat technologies that becomes magical. Try to accomplish the same things in Haskell or Clojure or Go and you'll find that you simply don't have the same tools available to you, and often they cannot be built as well as in Erlang because the foundation wasn't designed for it. And there's always some piece missing. For example, you can build an approximation of supervisor trees in Go, but since goroutines cannot be killed, you're at the mercy of the runtime. (I also wonder if goroutines scale as well as Erlang's.) Similarly, no one has actually built a functional, immutable, process-oriented call-by-name-and-signature RPC mechanism for Go, so you'll have to invent your own. And so forth. As a specific example, I was recently investigating OCaml to see if someone had implemented something similar to OTP. I found a couple of promising, nascent projects, but their activity all ended around 2009. Apparently nobody is doing it, even though the language seems damn near perfect for it. Never mind distributed processes; LWT is pretty weak even as an approximation of Go's goroutines. > [downtime] This doesn't need to be a language feature ... Erlang's live code replacement changes how you mentally think about versioning, I think. Instead of designing every piece of your infrastructure to transparently transition to a new version — using load balancers, multiple processes accept()ing on the same port, and so forth — you get a first-class language construct. This also opens possibilities beyond code deploys, such as temporarily injecting tracing into a running program. Also not often mentioned is how powerful it is to be able to connect to a running process and run the REPL inside it. (Ruby comes close here, but it's never been something you get for free.)
- mikkom 11y ago> They seem to have done a lot of things right'' This is because Elixir is "just" a different syntax for Erlang/OTP which is used in very mission critical software in real world (it was originally created for telephone systems)
- rdtsc 11y agoTo be fair, it is not just a different syntax. It can do a few things a bit better: * Streams * Actual macros * Mutable variables (not data, of course) Those would be kind of a pain to do in Erlang, maybe with parse transforms. I personally prefer Erlang better. I like its syntax and immutable variables. Haven't hit a need to need macros too badly yet.
- lectrick 11y agoWhere does Elixir allow mutable variables? AFAIK, it does not. Syntactically it might look like it allows mutable variables, but it actually does not.
- rdtsc 11y ago> Where does Elixir allow mutable variables? Everywhere pretty much. Learn a bit more how it works. Here is a good resource: http://elixir-lang.org/getting-started/introduction.html http://elixir-lang.org/getting-started/introduction.html Here is an example: iex(1)> x=1 1 iex(2)> x=2 2 x was 1, then it was 2. It mutated. To compare here is Erlang: 1> X=1. 1 2> X=2. ** exception error: no match of right hand side value 2 Just like in math, once X=1, it stays that. It doesn't get to mutate.
- nightwolf 11y agoThe variable isn't mutated, actually — it's rebound. See http://natescottwest.com/elixir-for-rubyists-part-2/ http://natescottwest.com/elixir-for-rubyists-part-2/, for example.