122 points · by tosh · 8y ago · 57 comments
That should not be meant to take away from these other projects that do interesting things. It just seems like people needlessly avoid Erlang because it's unfamiliar and they miss something amazing in the process.
Pattern matching and immutability are pretty sweet aren't they? So is homoiconicity and macros.
Did I suggest otherwise?
I find Erlang a harder tool to shoot yourself with than Elixir yet there are definitely some things it could improve on, and not only at the language level (always running xref on compilation would be nice).
For those who are not familiar, in Elixir you can write
result = value
|> f1()
|> f2()
and that is equvalent to result = f2(f1(value))
IO.inspect is a function that will fork a copy of its passed parameter to stdout, pretty-printed, and pass its parameter as the sole result.so if you wanted to check on on the values you can do this:
result = value
|> IO.inspect(label: "value")
|> f1()
|> IO.inspect(label: "result-of-f1")
|> f2()
|> IO.inspect(label: "result-of-f2")
This makes "println debugging" super, super, easy, because post facto cleanup doesn't require rebalancing your parentheses.Can you please elaborate? I was of the opinion it was the other way around.
An "atom" is an Erlang/Elixir thing, kind of like an enum value. "true" and "false" are implemented as atoms, you might create atoms to represent connection states ("idle", "connecting", "connected", "disconnecting"), or to represent errors ("file_not_found", "no_permission", etc). It's a really useful thing and something I miss in every language that doesn't have it.
In Erlang, a variable is a token that begins with a capital letter ("UserId") and anything that begins with a lowercase letter is either a keyword ("if", "case", "end") or an atom. Since keywords are a finite set, this is pretty straightforward. Module names and function names are atoms, so there's no additional complexity there.
In Elixir, a variable is a token that begins with a lowercase letter, unless it's a keyword or one of the special atoms "true", "false", and "null". An Elixir atom either starts with a capital letter (typically module names) or has a ":" in front of it (":file_not_found") or has a ":" after it when used as a map key ("file_error: :file_not_found" -- both words there are atoms).
So the problem that I run into is that identifying whether a token is an atom and, if so, if it's the same atom as in another spot, requires more thought than I think it should.
My Elixir experience was that there were quite a few cases like this where I hit minor friction. In general, I felt that Elixir code is a little easier to write but a little harder to read and Erlang code is a little harder to write but a little easier to read. I feel like the latter situation should be much preferred.
Personally I like the Erlang syntax better but most colleagues find it weird.
It’s not a dislike of Erlang as much as it is a joy of Elixir situation.
So Erlang syntax feels natural, I just don't have any use for it on my line of work.
Modern C-family/Algol-family syntax is nice but I certainly welcome trying out other syntax families (in the case of Erlang, Prolog-family).
A syntax should match the semantics of the language. C style is not the only way to design a programming language and does not fit all domains and semantics.
But clojerl does give you the chance to run on a better VM so in that respect it is good. ;-)
It's depressing I know. I will always write my personal projects in Clojure but it's a shame that I can't rely on it as the primary means of making a living.
Aside: If you let yourself get spoiled by Clojure’s efficient data structures and concise functions for manipulating them, it can be really frustrating to work in other languages that aren’t so data-oriented. It feels like it takes forever to “get to the point” when reading most traditional web application code.
On the other hand, if you have some flexibility with the program design, you can get many of the same benefits of Clojure in traditional languages by applying Clojure’s data-oriented architecture lessons (it feels almost as good as doing Clojure at work). Even frameworks like Ruby on Rails can be bent with minimal strain to fit the data-first paradigm; it does, however, require some departure from convention.
Finally, you can always use Clojure as a secret weapon at your own startup. One of the primary benefits of Clojure is the extreme simplicity of design, and conceptual compression you can achieve as a result. This allows small, even single-person, teams to build and manage an impressive degree of functionality with decent performance. Keep at it part-time, and you’ll grind out a solid MVP in a few weeks.
A community is a group of individuals. If you would like to see something like Rails in Clojure, there's nothing stopping you from writing it. "We don't do Rails" is as much a number of individuals not finding a use for a Rails-like framework as it is someone not having written one yet.
This isn't language or community specific. If there's something you want to see, write it! Expecting others to meet your needs smacks of entitlement. I find it much more empowering to think of areas for improvement as opportunities, rather than expecting everything to be handed to me.
As for job opportunities, some people value ease of getting a job, while others favor working in a language they prefer. Recognizing which you prefer is important, as is recognizing that others may not share the same priorities you do.
The beauty of this is, if you are using the JVM, JavaScript or Erlang, it doesn't even have to be green field. You can just write a section of the code in it.
I've experienced this ethic in others and it sucked (and the person basically shrugged and walked away). Obviously this could work out well, but I suspect most of the time it doesn't.
I'm sure there are situations in which it's perfectly fine though. Like working on your own on a fixed quote greenfield project.
I’ve been through that already for a relatively minor project and been asked not to do it again, even though the project worked out very well. The problem is we end up with something that can’t be properly maintained if I leave, and even if it’s a small service, it tends to grow in scope. Sadly we don’t really use any of the VMs you listed either.
People around me don’t doubt that you can do cool stuff in Elixir or Clojure, they just think it’s too hard to hire for these languages, and that the same is possible in any scripting language with Redis, Kubernetes, Kafka, etc.
Learning alternative languages opens our mind to architectures and approaches to solutions that we wouldn't though of when staying in a silo Developer X.
As for making a living in Clojure, there a couple of places in Europe using it, HN "Who's hiring" isn't the only source of job ads.