What did you first think of the Erlang syntax

Sorry about that. I’ll try to redeem myself:
I love syntax. I’m a programming nerd and a language nerd. I was, for a while, almost obsessed with the way OCaml and Haskell handled syntax with infix functions and the like, and how neat it can all look but also how easily it gets chaotic. I get that it’s important, and important in different ways to different people. I find things I love in every language’s syntax and can appreciate them all differently.

Syntax absolutely matters, because a language needs to provide a way for us to express our ideas in an understandable manner. Some languages need to express different things than others, and are therefore not meaningfully comparable. In that regard I think Erlang has incredible syntax, because it expresses the core of what Erlang is. It doesn’t hide or willfully obfuscate details, and it does all this without being insanely verbose like e.g. Go. The only quirk I can think of is the unfortunate but necessary exception A=<<"Hello">>.

All other things being equal, syntax is a personal preference and not something worth getting upset or religious about.

All the more power to you! I think it’s great that there’s a choice. As for one language losing out to the other, to me it’s unsurprising that targeting the already much larger Ruby audience with a new Ruby-like language gets the reputation from its users as looking nicer and easier to learn. In my opinion, it is things like Nx (Numerical Elixir) that should really excite people!

4 Likes

My first reaction when seeing my first bit of Erlang code was something like “OMG geez! :flushed:” It was a RabbitMQ example plugin, nothing fancy, I just looked in there out of idle curiosity. I didn’t need it, I had other things to do, the syntax put me off, so I left it at that. Anyway, that was how I learned that Erlang even existed, and I would read up more about it every now and then.

What eventually took me into Erlang was a chance coincidence of circumstances.

  • I had by then a long history of PHP, intermixed with some Java episodes, and was getting very tired of it. I wanted something new and different.
  • I knew that Erlang existed, had a rough idea of what it could do and be used for, and I had a feeling that I could handle it if I really wanted to.
  • A possible use case came up in my company. A project that was…
    • important enough to be a motivation to do it well and earn some brownie points
    • small enough to not overwhelm me doing it alone
    • big enough to be a challenge and learn something
    • had no deadline, so if the “do it with Erlang” idea wouldn’t have turned out too well, there would still be enough time to do it by other means. In fact, it turned out very well, and with occassional improvements, is running to this very day, 7 years and counting.

Summing it up, I had opportunity and motivation on top of otherwise fleeting interest. That is what took me past the initial hurdles that the unfamiliar syntax and concepts presented when I had my first and second looks at Erlang. And I started appreciating both the syntax and the concepts only after I had worked with them and after they had proved their merit to me. I probably wouldn’t have endevoured more into serious Erlang if it had been different.

That said, I think it is difficult to get into Erlang out of (idle) interest alone, especially when you are not used to the concepts surrounding Erlang as a system. You need opportunities and motivation to employ it to get to the point where you enjoy it :wink:

6 Likes

Hm, what did I first think of the Erlang syntax… Alien, a bit scary but interesting, certainly very different from what I had seen before, but not for the sake of just being different. Powerful is probably the word that comes closest to describing the overall impression it left on me. And when I got into it, I found that the system behind it, the stuff you could do with it, lived up to the promise.

I don’t think Erlang syntax is hard to pick up. It certainly is unfamiliar at first, more so when you are coming from other (mainstream) languages. But it is just an initial obstacle which, yes, might be bigger than what it would be if you were trying to pick up a different language, but nothing more. It is the same when, coming from English, you want to pick up Japanese vs German.
IMO, if you despair and turn away at the first obstacle, what makes you think you could deal with the obstacles that lie beyond it?

Joel Spolsky wrote an article on a similar topic back in 2005, btw, read it if you like :grinning_face_with_smiling_eyes:

4 Likes

Your wife married you because of Erlang?

4 Likes

Well first because I asked her, but it could be because of Erlang lol. Should have asked her in a .erl file.

4 Likes

I first saw Erlang around 2013, attracted by praises of its remarkable features.

I was surprised by the syntax but not scared. After a few minutes it looked nice. I loved the use of uppercase and lowercase letters to distinguish between Variables and symbols: it’s concise and I can partially relate it to the use of capital letters in natural languages to distinguish proper names from generic names.

I like the use of the punctuation, which I found meaningful and, again, somewhat analogous to its use in natural languages.

Overall I found it attractive. But I only played with it a bit then went back to focus on the JVM territory, which I regret a bit. :slight_smile:

I’m learning Elixir now as I’m guessing it will be easier to develop something with it or find a project to join, but I’d love to learn Erlang too after this.

4 Likes

My view of language syntax is much like @rvirding’s: learn it and move on. I had to learn a bunch of languages as an undergrad and, of course, afterwards, and who cares whether you use “do-end”, “begin-end”, “{-}” or whatever. Sure, it’s fine to have a preference, and I do. (I can’t say I loved the tiny bit of APL I learned, but it did help me out on linear algebra homework :slight_smile:

For Erlang, my initial reaction was some initial confusion, but it wasn’t hard to sort out. I had programmed in Prolog a bit as an undergrad, so the pattern language, periods at the end of things, atoms, and upper case variables were actually familiar. I liked the “->” stuff, because, come on, “in this case, the result is …” is very clear. Punctuation as separator rather than terminator is fine — at least it’s consistent. I do often wish I could write fun (X) → … and not write the “end” (probably because of my Scheme days), but it’s fine.

Like others, I think the Elixir pipeline syntax is cool, and I would definitely use it (though it would require some standardization on argument order). A bigger help would be hierarchical modules, though.

In the end, I actually do like Erlang’s syntax. Now that pattern matching is becoming much more mainstream, maybe that will help newcomers feel more at home, too.

3 Likes