4 ms·
I can't speak for Phoenix (yet), but today, I wrote my first macro for Elixir. I think I know what I like about Elixir. At its heart, it is a very simple langua
by travisgriggs 5y ago
I can't speak for Phoenix (yet), but today, I wrote my first macro for Elixir. I think I know what I like about Elixir. At its heart, it is a very simple language. It's not afraid to have an API that manipulates its own AST. 3 element tuple for every kind of AST node. That fricking simple. It makes it super easy to reason about the code and rewrite/restructure it programatically.
It's like an abstraction of the RISC vs CISC debates. A language built from a few simple consistent building blocks, or a massive amalgamation of corner case optimizations designed ad hoc for each situation as it arises?
Years ago, I was a full on Smalltalk enthusiast/ninja. One of the coolest tools that ever existed in the Smalltalk world was the Refactoring Browser written by John Brant and Don Roberts. It blazed the trail and wrote the book in IDE driven code refactoring. In all of the IDEs I've used since outside of Smalltalk, I haven't seen a refactoring they didn't implement, and there were quite a few I've never seen outside of that environment. Which was interesting, because Smalltalk has no manifest typing (it's run time typed rather than compile time).
I once asked John and Don if they were going to do the same tooling for for Java in Eclipse. It would have been the bomb in those days, and probably a great money maker. I theorized that some of the "fuzzier" parts of refactoring Smalltalk code would be easier because of Java's manifest typing. Don replied that he had thought that as well, and they had looked at it. But what they had found was that if there was a gain in having the types available, it was dramatically overpowered by the complexity of the Java AST (this was in the early days of Java too). The corner cases of trying to transmogrify code in a behavior retaining way just blew up combinatorially with all of the different corner cases. They looked at doing the same for Ruby eventually when it began gaining in popularity. Ruby, like Smalltalk, has no manifest types. But they found the same thing. At the time, there were 90+ different node types for a Ruby AST. And it was much more difficult.
So all of this tale is just a long way of saying, I'm liking Elixir so far. It's fundamentals are strange and paradigm challenging for me. That will take some patience to surpass. But I believe that platforms built on fewer scalable parts, rather than lots of syntactic sugar and variant execution models (I'm looking at all you "hybrid" languages), are better in the long run and way more empowering.