jacquesm 4 hours ago

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.

  • noir_lord 3 hours ago

    > 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.

    The big open source projects where pretty much all like that in the past, in the 80's/90's/early 2000's - in that respect they feel like a pleasant anachronism before everything needed to be promoted/self-promotional influencer like, the users did the evangelism but the creators where usually much more chill.

    Obviously the vast majority of open source projects are still like that but there is definitely a lot more in your face promotion of things that feels different somehow almost aggressive/corporate style even when there is no paid product.

    Not knocking the ones who do it, if it's open source they can sing it from a mountain top for all I care, the license it's under matters more.

    • isodev 2 hours ago

      I think what has changed mainly is that today we have tools, languages and entire ecosystems that exist only as means to support someone’s product line.

      Take Swift for example. A giant gatekeeper of a corp decided to make it the only (reasonable) way to build apps and so it exists, powered by countless indie developers constantly creating content around it. Would Swift be a thing without everyone being forced to use it? I don’t know, but I don’t think so.

      So in some ways we’ve traded unique and effective solutions to “popular and mainstream” things that scream the loudest. You wouldn’t get fired for choosing Swift. Or Azure.

    • kace91 an hour ago

      >somehow almost aggressive/corporate style even when there is no paid product.

      For those who collaborate with open source for political/ideological reasons (which does not need be the case), it makes sense to join the battle for attention.

      As long as the product isn’t compromised in the way, I think it’s very good to see open source influencers.

      • pxc 34 minutes ago

        GNU Guix has a good blog, but I don't feel like they are very "marketing" focused.

        It's hard to describe precisely, but a lot of free software projects do a good job of putting themselves out there in an unfussy way. There really is something refreshing and cozy about that.

    • actionfromafar 2 hours ago

      I think it's because we are wired that attention is it's own currency nowadays. And it's also true. Even if there's no paid product, you get strength in numbers. If you depend on an open source library, it's usually better for you if others depend on it too.

      • noir_lord 2 hours ago

        Certainly an element of that but there are also cases where the superior product "lost" to the inferior product because the inferior one was better marketed.

        So doing some level of promotion becomes necessary if you want users even when you have the better product - the superior product speaks for itself doesn't often apply any more.

        • marcosdumay 12 minutes ago

          > doesn't often apply any more

          It actually never did, for almost any product.

          And programming languages are in the lower end of quality actually impacting decisions. People are incredibly resistant to changes there, and just can't evaluate competing options at the same time.

  • marceldegraaf 3 hours ago

    It's funny that you mention this, and it made me take some time to appreciate I've been working with Elixir full-time for almost 10 years now, and the entire experience has been so... stable.

    There's been little drama, the language is relatively stable, the community has always been there when you need them but aren't too pushy and flashy. It all feels mature and – in the best possible way – boring, and that is awesome.

    • noosphr 2 hours ago

      I've moved from Linux to OpenBSD for this reason.

      It's all so boring it's wonderful.

      • christophilus 8 minutes ago

        I like OpenBSD, but I like Docker and Steam too much to daily-drive it.

    • [removed] 3 hours ago
      [deleted]
    • zwnow an hour ago

      For me it took a tremendous amount of work to somewhat understand the OTP stuff though. Its one of those languages where I can never be confident about my implementations, and thankfully it has features to check whether you have stale processes or whatever. A language I am humbled by whenever I use it.

  • sph 2 hours ago

    I don't think it's cycles, more like newcomers rediscovering the future.

    I've learned Elixir in 2016 after a lull in my interest in programming languages, and 9 years later it's still my favourite environment by a country mile. It's not the language per se, but the BEAM, the actor model, the immutability — just makes sense, and doing things the C/Rust/Javascript/Python way is like building bridges out of cardboard.

    For example, I've stepped into the world of game dev and Godot, which is fantastic and uses a regular object-oriented model. After trying to build a non-trivial desktop app with it, my thoughts are consumed by the fact that mutable state and object orientation is the silliest idea, and I'm speaking as someone that really got into Smalltalk and message-passing objects.

    I don't even need actors and OTP, I just want some immutable data structures and functions operating on them. Erlang/Elixir are fantastic to build servers, but there is a sore lack of something closer to the metal within 80% the speed of a native language. I would build an entire operating system out of it. Why has no one put microkernels and Erlang into a blender? I know there's QNX, but it's still UNIX, not Erlang.

    • mycall 23 minutes ago

      What about OCAML, does that fill your needs?

      • sph 19 minutes ago

        It’s perennially in my list of languages to check out. It felt harder when I looked into it 15 years ago. Now that functional programming is second-nature, it should be much easier.

        Thanks for the reminder.

  • mycall 27 minutes ago

    Does anyone know if matrix.org has any Erlang implementations? It seems like the perfect fit to me.

  • SeanDav 3 hours ago

    I am just wondering when the next "We-Love-Haskell" cycle is going to start!

  • rat9988 an hour ago

    Nice write up. Thank you for taking time to evangelize it.

jrm4 4 minutes ago

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

bmacho 7 minutes ago

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

donatj 2 hours ago

> 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.

  • marcosdumay 4 minutes ago

    Yes, people with mathematical background tends to fare better with declarative languages.

  • npteljes 2 hours ago

    Pascal also had := for assignment, if I remember correctly. I disliked it, to be honest, = is pretty much universally accepted in the IT world to mean "assign to".

    I don't think this is something that keeps someone from programming. If it does, then the other 100000 hoops won't be better, every trade has its "why the fuck is this the way it is" moments.

    If you'd still try programming with her, I think you could start with a visual programming thing. Maze from Blockly Games is a simple online logic game that can be overcome with visual programming. No need to register or anything. The levels get progressively harder, as it teaches to apply programming concepts, and makes the player combine them. As a programmer, I found the game really fun, and I think it's suitable for beginners as well, seeing how for example LEGO used a very similar system for its programmable sets.

    https://blockly.games/maze?lang=en

  • ngriffiths 2 hours ago

    I think it makes more sense in languages where you use the "let" keyword. Then it sounds like assignment, though you still have to get comfortable with the X being on the right side too.

  • SeanDav 2 hours ago

    It is not a lie it is just apparently familiar notation that actually has an entirely different meaning. It is not an equation, it is an assignment.

    X := X + 1 is perhaps less confusing, even if meaning the same thing.

    • npteljes 2 hours ago

      That's exactly right. Looking at the Assignment Operator Wiki page, it's also clear where these notations come from.

      I think an easy way to look at it, for someone coming from a math background, is to think of programming lines as instructions, instead of statements. x=x+1 can be then read as "let x be x+1", and that's it.

      https://en.wikipedia.org/wiki/Assignment_(computer_science)

  • macintux 40 minutes ago

    I've shared it here once recently, so might as well again.

    I gave a talk at Midwest.io (sigh, such a great conference, shame it faltered) building Erlang from the ground up, starting with the = sign and the implications (side effects?) of it being a runtime assertion of truth in addition to a binding.

    https://youtu.be/E18shi1qIHU

mrkeen 4 hours ago

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).
  • bargainbin 3 hours ago

    > (mailbox = mailbox + message) is so simple!

    The author did not say this at all, they barely even touched on capabilities of erlang/OTP. Their focus was on the functional syntax of Erlang.

    > For instance, in head(sort(list)), will the whole list be sorted, or will the smallest element be returned?

    Your point isn’t clear. The functions have a clear nested call sequence, take a list, sort it, get the head.

    Also how is it any different than Haskells `head (sort list)`?

    • ctenb 3 hours ago

      In Haskell with `head (sort list)` the entire list does not have to be sorted, depending on the sort implementation. Everything is lazy, so sort can sort the list just enough to return the smallest element.

      • auggierose 2 hours ago

        Going beyond laziness, a compiler that can understand and exploit equations, could use `head (sort list) = smallest (list)` to make the program more efficient, going from O(n * log n) to O(n) complexity.

    • mrkeen 2 hours ago

      > The author did not say this at all, they barely even touched on capabilities of erlang/OTP.

        Two separate Erlang nodes. On different machines, different networks, different continents if I wanted. And they could just… talk. No HTTP. No REST API. No serialization headaches. Just message passing. Just actors doing their thing.
      
      > Their focus was on the functional syntax of Erlang.

      They didn't write any Erlang until the ping/pong example, which doesn't have any functions. What does pong() equal? Is it equal to itself even? What's its domain and range? If I wrote a unit test for it, what test inputs would I give it and what outputs would I assert?

      • [removed] 2 hours ago
        [deleted]
    • petrzjunior 2 hours ago

      I think the question is whether sort should return a new, sorted array or whether it should sort the array in place. In functional languages it is the former, in imperative the latter.

      • knome an hour ago

        It can be quite useful to have nondestructive sorting in imperative languages as well. Hence python introducing 'sorted' even though '.sort()' preceded it.

macintux 34 minutes ago

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-...

imglorp an hour ago

> “How can you sum the numbers from 1 to 10 without using a loop?”

Sum = n(n+1)/2

  • KingMob 23 minutes ago

    Yeah, I assume it's missing some context that the numeric solution was off the table.

    • javcasas a minute ago

      When all you know is hammers, all you can think of are nails. Screws are impossible to use and understand. How are you supposed to hammer in a screw? All those ridges are in the way!

ctenb 3 hours ago

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.

sam-cop-vimes 3 hours ago

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.

  • tommica 3 hours ago

    > Suddenly Erlang made it fun and programming became addictive.

    I'm saying this with complete sincerity: WHAT IS IT THAT YOU PEOPLE SEE!? What is the fun? What are you addicted to? Typing and seeing the output? Solving a problem?

    I feel like I am missing out on some amazing life altering experience when I see people state that. The same thing I have with the article - what does it mean to love a programming language?

    • christophilus 2 hours ago

      It’s a subjective thing, but when a language clicks for you, work becomes pleasant. You get into (and maintain) a flow state. It feels as if you’re crafting something beautiful and elegant and simple. It’s the same reason people love painting, drawing, or sculpting with one specific medium over an other. They just like the aesthetic and process better.

      Also, some languages just really stink— slow compilation times, obscure errors, loads of footguns and require much more care and focus on things which are orthogonal to the problem you’re trying to solve.

    • sam-cop-vimes 2 hours ago

      I'll try and answer this.

      Expressiveness: I could express a solution to a problem with very few lines of code and without the clutter of housekeeping operations like memory management.

      Recursion: Erlang properly introduced me to recursion whereas I hadn't encountered it before. This is again related to expressiveness. There is something strangely beautiful about seeing a problem solved using recursion elegantly.

      Message passing: when I was trying to figure out how Microsoft's C++ socket classes were implemented and I dug into the code, it turned out there was a hidden window for every socket created and messages were being passed to/from it, but message passing wasn't available anywhere in Visual C++ as a first class construct (at least as far as I remember it). I was overjoyed when I discovered that message passing was a first class citizen in Erlang and how much easier it was to implement concurrent programs than using native threads in C++.

      Compared to OO programming in C++ where I was never sure whether I was using inheritance correctly, whether I needed inheritance at all, memory management, difficulty with threads, writing code in Erlang was a breeze.

      And the whole support for distributed programming, hot code loading, list comprehensions! I fell in love again with Erlang when I discovered list comprehensions. Man, I could go on.

    • cmoski 2 hours ago

      Solving problems I guess. Have you used painful languages before? Imagine doing that, then discovering one that wasn't getting in your way all the time. It's easier to do things that are difficult in other languages. You can do so much on the BEAM, and you don't have to waste your time with thread pools or other nonsense.

    • knome an hour ago

      when I program, I am visualizing the machine I am building in my head. some language semantics are cleaner than others, allowing the bits and pieces to flow together more naturally, composing in elegant ways that do not require pointless effort be spent manually wrangling footguns and minutia.

RickJWagner 5 minutes 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.

az09mugen 9 days ago

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.

  • darkwater 3 hours ago

    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.

bishabosha 2 hours ago

this whole article stinks of AI prose, why should i read it

  • croisillon an hour ago

    the author loves Erlang, but not to the point of writing their love themself

andoando 3 hours ago

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"

  • davidsainez 2 hours ago

    It is difficult to understand the full beauty (or horror, depending on your pov) of functional programming with such a simple example. But as you scale up in complexity, it can be someone’s full time job to make sure the model is accurately translated to the computer’s memory. With a pure language, the compiler is responsible for maintaining the mapping to memory, so you (mostly) just focus on the symbolic relationships of your model. This can be extremely freeing once you train yourself to think in functional terms. Of course, there is a performance cost, but this can be managed and in cases where people turn to functional programming reliability and correctness outweigh the cost.

    • fpoling an hour ago

      Pure languages still use stack to store mutating state. In a single-threaded programs this is almost non-observable except for occasional stack overflow crashes. But with multiple threads and message passing one can emulate arbitrary state mutation just by using messages and stack.

      Then I have found the code that is a heavy user of closures is harder to understand even if it is single-threaded and closures can pass arbitrary state even if the state is immutable.

      What I have found useful is persistent data structures. Those really simplify modelling. But then those can be used in imperative languages as well.

  • lionkor 2 hours ago

    That's why I like the

        x := x + 1
    
    syntax better, or the

        let x = 2;
    
    syntax
  • ceayo 2 hours ago

    > even in the sum example, you see the statement "N is n-1"

    That wasn't actually what the example said. It said N1 = N - 1, and continued using the N1 value somewhere else. In that example, no actual mutation occured.

abrookewood 4 hours ago

Great article & I love the command line interface on the home page.

nakamoto_damacy an hour ago

Will it ever run in WASM?

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

4gotunameagain 2 hours ago

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 ;)
  • mrkeen 2 hours ago

    Port ping.erl and pong.erl to C and we'll compare them.

    • 4gotunameagain an hour ago

      But I am not contrasting the two languages, I'm very aware of their respective strengths and weaknesses.

      I am just disagreeing with the fact that C is hard to parse.

  • cess11 2 hours ago

    They didn't make such an argument. It's a biographical rumination about the authors personal development and feelings.