54 comments

[ 0.12 ms ] story [ 73.4 ms ] thread
Unrelated to the topic, but I really like the feature `> cd ..` at the bottom of the article. It's simple and accessible even with a smartphone. I wonder if there is an easter egg inside.
I'd also love a `cd -` on the top left
Because the homepage has this "interactive terminal" which is funny and nice (kudos for readline shortcut support) but also partially "broken", i.e. the blog post(s) and other links you see with "ls" are not clickable, at least on Firefox.
Great talk i love it and thanx for sharing.
Great article & I love the command line interface on the home page.
Nice post, looking forward to more!
It's funny how HN goes through these Erlang cycles. It's a long standing tradition, starting off with 'Erlang Day': https://news.ycombinator.com/front?day=2009-03-11

Erlang gets a lot of stuff right for scalable web based stuff, and even though there are many of its influences that have by now made it into other languages and eco systems it is still amazing to me that such a well thought out system is run with such incredible modesty. You'll never see the people behind Erlang be confrontational or evangelists, they just do what they're good at and it is up to you whether you adopt it or not. And that is an interesting thing: the people that are good at this are writing code, not evangelizing. If I had to reboot my career I'd pick this eco system over anything else, it has incredible staying power, handles backwards compatibility issues with grace and has a community that you can be proud of joining. Modest, competent, and with a complete lack of drama.

> You'll never see the people behind Erlang be confrontational or evangelists

Can I interest you in my Rust project hosted in Jujutsu VCS?

The hyperbole that Haskellers invoke around pure-functional vs impure is that you're never quite sure whether a function call you make will "fire the missiles".

It's colourful language, but it's just a stand-in for other properties you might care about. For instance, in head(sort(list)), will the whole list be sorted, or will the smallest element be returned? In atomically(doThis(); doThat()), will doThis be 100% reverted if doThat fails? If you stick to pure functions (and in the second example, STM) then you can unfire the missile!

AFAIK, Erlang just fires the missile "over there", not "over here". The author jumped from:

  (X = X + 1) is bad
to

  (mailbox = mailbox + message) is so simple!
I'm not bashing the BEAM, or the ease with which one can send messages (as an Actor language), but I am complaining about the lack of tooling to write non-missile-firing functions on a single node (as a Functional language).
My confusion here is it always seemed liked a simple mapping to take = to mean "make x equal to x+1" rather than "x is already equal to x+1".

It is declaring a relationship, between the previous value and the current. One way or another, youre defining transformations.

I mean even in the sum example, you see the statement "N is n-1" which is the exact same thing as x = x+1 with = swapped for "is"

I can totally relate to this. Programming in Erlang felt so natural compared to the knots I was twisting myself into writing C++. I was churning out C++ code, but wasn't having fun. Suddenly Erlang made it fun and programming became addictive.
I think the older programmer was hinting at gauss's formula with the summing 1 to 10 without using a loop? Recursion is also a loop in some sense.
[dead]
Yep; the submitted article is just pedestrian with lots of posturing and pretty language to sell it. There is nothing of Programming/Mathematics/Erlang in it to deserve the upvotes.

Some of the comments here are far more informative.

> X equals X plus one? That’s not math. That’s a lie.

That's really interesting... My wife, who has no real mathematical background had the EXACT same reaction when I was trying to teach her some simple programming. I tried to explain that equals in that context was more of a storage operator than a statement that said line is true. She found it very frustrating and we gave up on the endeavor shortly thereafter.

I've personally always had a soft spot for languages like TI-BASIC that use a storage operator rather than overloading = so for example:

X + 1 -> X

I wonder if I should try a functional language with her.

I explain "X equals X plus one" as though each variable has an implicit version that increases whenever it's written to or as time goes on, but we can only access the lastest version.

For example

    X = X + X
is really

    Xv2 = Xv1 + Xv1
Cuis Smalltalk

    x ← x + 1

Although you'd need to type

    x _ x + 1
and it might copy/paste as

    x := x + 1
> She found it very frustrating [...] I wonder if I should try a [different language] with her

Or, perhaps, preprocess left-arrow to equal?

Customizing a language to taste. Especially for shallow syntactic issues. Like "no multi-line string literals allowed ... I'm sorry, that's just not ok". Or "ok kid, what nicknames would you like to give the keywords today"?

When programming for just fun, I'll sometimes go "this aspect of the language bugs me - I could of course just live with it... but here, I think it will be more fun not to". So for recent example, a few lines of recast.js ast tweaking, and I could use infix unicode mathematical symbols as javascript functions.

I wonder if one could teach programming by build-your-own language. Perhaps even of the video-scanned desktop variety. "Draw a circle around your toys to create a collection. Label it with a letter. Now you can sort/filter it by..."

Tell her there are transparent subscripts on each use of =.

x(0) = 1

x(1) = x(0) + 1

There's no way to reference the subscripts. They're implicit and the language manages it for you. Ask her to think of the Kronecker delta function and it's definition.

Calls a simple swap function with pointers inscrutable (the only hard to decipher character is the asterisk), and as a good counterexample provides this ?

  -module(ping).
  -export([start/0, ping/1]).

  start() ->
      register(ping, spawn(fun() -> ping(0) end)).

  ping(Count) ->
      receive
          {pong, Pong_PID} ->
              io:format("Ping received pong (~p)~n", [Count]),
              Pong_PID ! {ping, self()},
              ping(Count + 1)
      end.
I am not against functional programming, or using the tools you love, but at least make a valid argument about it ;)
> ...at least make a valid argument about it ;)

Like other folks have said, show the equivalent C program and then we can have a discussion about implementation complexity and comprehensibility.

Do note that the equivalent C program permits IPC between two instances of the program that could be either running on the same machine or could be running on different machines connected by an IP network.

Edit: For general information, here's an Erlang implementation of increment and swap. Swap is made a bit complicated because Erlang doesn't support multiple returns... returning a tuple or list is the way that's handled, so I had it accept a two-element tuple for consistency with what it returns:

  increment(A) -> A + 1.
  swap({A, B}) -> {B, A}.
this whole article stinks of AI prose, why should i read it
Will it ever run in WASM?

EDIT: there is Lumen, but not sure if it's stalled or still going.

> Will it ever run in WASM?

A ten-second search reveals [0]. (Have Kids These Days forgotten all about Emscripten?) However, given that web browser pages are often short-lived, I don't see what benefit bringing in all of Erlang and its VM gets you, other than the fact that you've pulled off the stunt.

[0] <https://www.antvaset.com/erlang-otp-wasm>

WASM runs on the edge, e.g. in Cloudflare workers (but I mean more generally) .. And it is an emerging compatibility layer
> “How can you sum the numbers from 1 to 10 without using a loop?”

Sum = n(n+1)/2

Not even Erlang can beat Gauss
I remember being amazed when I learnt about summing arithmetric series.
I discovered Erlang from Bruce Tate's book[0] and it was such an obviously pragmatic and interesting language that I started participating in the Twitter Erlang community, discovered Basho was using it for Riak and looking for a tech evangelist in the Midwest, and thus began my all-time favorite job.

I'm still more of a infrastructure guy than a software developer, but working with such incredibly smart people was a delight. Basho was good at hiring people who could learn Erlang (and, perhaps unsurprisingly, was almost entirely remote).

[0]: https://pragprog.com/titles/btlang/seven-languages-in-seven-...

There is also Erlang the Movie 2 trying to sell Erlang (called Outlaw Techno Psyhchobitch in the video) with rock and hot chick: https://youtu.be/rRbY3TMUcgQ?t=262

And they were right, rebranding was all Erlang needed 13 years ago

Fantastic article, my thanks to the author.

I must go dig up the Erlang book from my library. As I recall, it was a great read.

For what it's worth, I'm stuck on the very first x = x + 1 thing.

Not sure if you want to call it a screwup or bad grammar or whatnot, but it is perhaps the huge mistake that the "equals" sign was used for something that feels like, but emphatically DOES NOT mean, "is equal to."

It's "put this into that". It's an action verb. Should have perhaps insisted on x <- x + 1 or maybe better x + 1 -> x

I want to get into Erlang, but I also know a lot of languages that are cool, effective, but rarely used in jobs.
If you like Erlang, I recommend reading Making Reliable Distributed Systems in the Presence of Software Errors by Joe Armstrong: https://erlang.org/download/armstrong_thesis_2003.pdf

His PhD thesis explains the thinking behind Erlang, especially how it handles failures, message passing, and concurrency. It was last updated in 2003, 22 years ago, time really flies!

Thank you for this, I'm unlikely to ever touch Erlang but looks like a fascinating read nonetheless.
> “How can you sum the numbers from 1 to 10 without using a loop?” ... And there it was: recursion.

Wait, is there something I don’t actually understand about recursion? When a recursive function calls itself, is that not a loop?

R.I.P Joe Armstrong - he was an amazing man, engineer, and human overall. :(
I used Erlang for a couple of years. It's cool and elegant for sure, but it always felt like it took longer to write than JS or Py like I'd otherwise use. Recursion with matchers is sometimes natural, sometimes roundabout to what you want to do.

The multiprocess stuff is cool too, but a premature optimization for what I was doing. If I needed to scale, I don't know if that'd be the chosen approach.