Live data from Hacker News

How I fell in love with Erlang

boragonul.com

131–140 of 263 posts

Re: How I fell in love with Erlang

#131
Took me a long time to figure out what gets lost with Erlang is:

a) Ubiquity — everything understands HTTP. Erlang nodes only talk to Erlang (or a compatible runtime)

b) Because there are no middleware standards (REST, GraphQL, OAuth, etc.), you must build or integrate your own abstractions

c) Giving up infrastructure (reverse proxies, load balancers, CDNs), You handle distribution yourself or through OTP design

d) Interoperability with browsers and APIs, requiring bridging via something like Cowboy or gRPC gateway

setcookie secret in Erlang does not create or use an HTTP cookie, SSL certificate, or HTTPS connection. It sets the Erlang distribution cookie, a shared secret string used for node authentication within the Erlang runtime system (the BEAM VM).

Erlang’s built-in distributed networking subsystem allows them to connect to each other if:

1) They can reach each other over TCP (default port 4369 for the EPMD — Erlang Port Mapper Daemon — plus a dynamically assigned port for the node-to-node connection).

2) They share the same cookie value (here "secret").

The author's insight "No HTTP. No REST API", reframes the reality that Erlang moves things down the ISO OSI model - HTTP being on layer 7 and TCP being on layer 4. Erlang therefore misses the "benefits" of operating on a higher ISO layer, but gains powerful advantages of operating on layer 4:

i) True concurrency

ii) Transparent message passing

iii) Fault tolerance

iv) Soft real-time guarantees

v) Persistent cluster connections

Erlang’s design assumes a trusted, closed system of cooperating nodes, not a public Internet of clients. In other words, Erlang doesn’t live below Layer 7 — it IS its own Layer 7.

Re: How I fell in love with Erlang

#132
post #7

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 i…

> 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 evange…

It isn't entirely true though. The original Erlang guys made Erlang: The Movie https://www.youtube.com/watch?v=xrIjfIjssLE and the sadly missed Joe Armstong made plenty of blog posts https://joearms.github.io/ and public appearances and expressed a number of strong opinions (though genially) https://www.youtube.com/watch?v=lKXe3HUG2l4 . Robert Virding's public profile is not as high, but he's by no means in hiding either. https://www.youtube.com/watch?v=naTisAcey5Q — or indeed https://news.ycombinator.com/user?id=rvirding )

Re: How I fell in love with Erlang

#133
post #69

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

I believe you can blame Ken Thompson for this. In DMR's paper about early C history, he says:

> Other fiddles in the transition from BCPL to B were introduced as a matter of taste, and some remain controversial, for example the decision to use the single character = for assignment instead of :=.

I think Ken did most of the early design of B and DMR came along later to help with C. Ken has a famously terse style, so I can definitely see it being on brand to shave of a character from `:=`, which is what BCPL uses.

It's sort of a tricky little syntax problem. It makes perfect sense to use `=` for declarations:

    int x = 1;
At that point, you really are defining a thing, and `=` is the natural syntax for a definition. (It's what BCPL uses for defining most named things.)

You also need a syntax for mutating assignment. You can define a separate operator for that (like `:=`). Then there is the question of equality. From math, `=` is the natural notation because the operator there is often overloaded as an equality predicate.

Now you're in a funny spot. Declaring a variable and assigning to it later are semantically very similar operations. Both ultimately calculate a value and store it in memory. But they have different syntax. Meanwhile, defining a variable and testing two expressions for equality use the same syntax but have utterly unrelated semantics.

Given that math notation has grown chaotically over hundreds of years, it's just really hard to build an elegant notation that is both familiar to people and consistent and coherent.

Re: How I fell in love with Erlang

#134
post #22

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

Am I wrong to be skeptical that this was a thought author had at 8 years old? I don't doubt that 8-year-olds can learn programming and advanced math, but even the brightest 8-year-old would still be in the "sponge" stage. It's hard to believe they would have a sufficiently fixed idea about algebra to be troubled that X = X + 1 is "wrong".

Kids can be flexible but also rigid about the most random things. My two year old gets really annoyed if I use the wrong spoon to stir my tea, saying certain spoons are only for food or cereals. I don't know where she got that – it's definitely not a practice we ever enforced!

Re: How I fell in love with Erlang

#135
post #100
post #29

Earlier quoted context omitted.

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

Lets count the number of comercial sucesful released games that don't use mutability or object orientation.... I can't find any.

> Lets count the number of comercial sucesful released games that don't use mutability or object orientation.... > > I can't find any.

They use it, but the best tend to minimize mutability. And as for object orientation- merely 'having classes' is not the same thing.

Re: How I fell in love with Erlang

#136
post #54

Earlier quoted context omitted.

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 aweso…

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.

It also took me quite a bit of time to understand OTP. In fact, I had to have a project that actually required what OTP offered to really get it.

Two things that definitely helped me understand were reading the somewhat-dated-but-still-useful material on the topic in Learn You Some Erlang, as well as reading through the "OTP Design Principles" section of the Erlang System Documentation.

Re: How I fell in love with Erlang

#138
post #14

Earlier quoted context omitted.

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

Feels like Rust has stolen a lot of Haskell thunder, in the sense you can write similar code and satisfy that functional programming itch in a much more popular language, while falling back on imperative programming if you really need it.

I haven't been following closely, but my impression is that the dependently-typed languages/theorem-provers have stolen some of Haskell's "most purely functional, most strongly typed" hype-thunder even though they're even further from being a mainstream implementation language for most projects.

Re: How I fell in love with Erlang

#139
post #69

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

Doubling down on my downvotes, then:

Look, I teach IT (to both novices and interested folks at a college) for a living; count this idea as one that, when I present it this simply, many a lightbulb goes on for those new to programming. Much like for zero-indexed arrays, I do very well with "look, this is stupid, but here's why it got that way, we'll just deal with it."

And while on occasion I take pride in nerd-dom, I feel like -- especially with the advent of AI for coding -- this is dinosaur stuff, where we would do better to go along with what's WAY more intuitive than to try to stick with mathematical or programming purity, etc.

Re: How I fell in love with Erlang

#140
post #130
post #69

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

> It's an action verb. The difference is that it is an instruction. Conventional mathematical notation, while declarative by default, switches into instruction mode just the same with the "let" keyword. The usage of the "=" operator then becomes equivalent: e.g. let x = 1. But as the aforementioned x = x + 1 comes from notations that are never declarative, where every statement is an instruction, the "let" keyword is…

Is that the topic?

I do think what I'm trying to say here is: sorry, but your "conventional notation" sucks because "what is actually happening" is so very different from how the thing is overwhelmingly used for most people.

Post reply on HN