News for hackers. Stuff that matters.
Re:The Zen of Erlang (2016) by j_m_b on Sunday July 19, 2020 @09:19AM (#23889152)
Is Erlang about to be the next big thing due to companies unable to use Huawei and instead going with Ericsson for 5G deployment?
Re:The Zen of Erlang (2016) by s3cur3 on Sunday July 19, 2020 @01:17PM (#23890791)
The Erlang ecosystem (including my personal favorite BEAM language, Elixir) has been kind of a secret weapon for a lot of companies for years. There are a handful of freelancers in the community who have had the experience of going to work for a company doing Erlang/Elixir, only to be told they can never reveal the company’s identity because they consider the language a competitive advantage. One big corp went so far as to say they use Java in all their public-facing info (including hiring).
Re:The Zen of Erlang (2016) by enraged_camel on Sunday July 19, 2020 @03:47PM (#23891935)
I'll just come out and say that this is true for us at PriceTable. :)

I've used Rails, Node.js and .NET before this, and none of them came close to Elixir in terms of developer productivity, not to mention system stability.

Re:The Zen of Erlang (2016) by ativzzz on Sunday July 19, 2020 @06:44PM (#23893062)
How much of this actually has to do with using the language? Unless the companies are solving very specific technical problems that Erlang/Elixir are designed to solve, what really matters is productive software devs and managers, and that is more defined by expertise and domain knowledge in a particular language than the language itself (within reason: you're not going to choose C over Ruby for a web app backend).

How much of this is due to (the minority of) devs that can code Erlang/Elixir being more experienced/productive regardless of the language? Or just having good tech management?

Re:The Zen of Erlang (2016) by andrewflnr on Sunday July 19, 2020 @08:18PM (#23893550)
I've heard this before, and despite my cautiously being on the Elixir bandwagon, this story triggers my BS sensor. Assuming their competitors are already invested in another language, it will be expensive for them to switch, and the company using Erlang/Elixir gets good press from using a hipster language. Can someone point to specific people that said they were barred from revealing their BEAM-using employer?
Re:The Zen of Erlang (2016) by gjvc on Sunday July 19, 2020 @04:59PM (#23892389)
Re:The Zen of Erlang (2016) by bobbyz on Sunday July 19, 2020 @08:03PM (#23893475)
Does it though? StackOverflow's predecessor was created one year after this was written, meaning it was likely written in an environment without SO. Easily finding the solution to your every problem is the ultimate programming language feature.
Re:The Zen of Erlang (2016) by apta on Sunday July 19, 2020 @03:43PM (#23891896)
What does Erlang offer that the JVM or .NET don't?
Re:The Zen of Erlang (2016) by smabie on Sunday July 19, 2020 @10:11PM (#23894104)
While there is actor support through Akka and Akka.net on the JVM and .NET, neither of them support preemption like the BEAM does. Preemption of blocking actors is a game-changer in terms of how you write and structure concurrent code. I wrote a BitTorrent client in Scala using Akka and found myself desperately wishing that I could write actors in a blocking style. The amount of extra complexity and book-keeping required to write purely non-blocking actors is truly staggering.

Let me give you an example. I have an actor that asks for two objects from a DbActor, and then sends them to the AdderActor to get the sum. Without preemption, I have to do the following.

1. Send a message to get object A and object B. Return.

2. Wait for an object.

3. When I get the object, figure out if it is object A or B (or maybe it's something else entirely). Update internal state so that I know I need one more object. Return.

4. Wait for an object

5. Get the object, figure out if it is object A or B (or something else). Update internal state so I know that I have both objects. Send the two objects and my Add message to the AdderActor. Return.

6. Wait for the result.

7. Now that I've gotten the result, update internal state saying that I've completed my A+B operation. Either store the result of A+B or whatever.

This method requires a lot of internal booking and a lot of mutable hash tables in order to keep track of all the various stuff this actor is in the process of doing. If I'm trying to calculate A+B and C+D, I need to know how far along I am in each computation. This is a buggy and annoying process that creates a ton of complexity.

Let's look at how we could do it in Erlang:

1. Send a message saying we want object A.

2. Don't return, and instead block until we get A. Now we ask for B.

3. Block until we get B. Now send the A+B message.

4. Block until we get it. Do something. Return.

See how much easier this is? Because we can block, our code actually can be structured to look like normal, non-concurrent code. It can be executed in a sequential fashion, even though the actual computation is happening somewhere else. With Akka and Akka.net, we can't do that. We have to return as quickly as possible, or else we are going to lock up the entire system. This means that all of the implicit state that a normal program has (like current line being executed), must be stored explicitly by our program.

It sucks, but hopefully the JVM will get preemption sometime soon. The actor model doesn't really work with out it. And even though it doesn't work without it, it's still better than threads and mutexes.

Re:The Zen of Erlang (2016) by sbalea on Monday July 20, 2020 @08:58AM (#23897331)
In Scala/Akka, you could use the ask operator and compose the resulting Futures, something like this:

  for {
    a <- aProviderActor ? gimmeA
    b <- bProviderActor ? gimmeB
    aPlusB <- adderActor ? (add, a, b)
  } yield aPlusB
Re:The Zen of Erlang (2016) by smabie on Monday July 20, 2020 @12:49PM (#23899588)
Yeah, but you're blocking the thread. It's very very easy for you to deadlock the entire system writing code like this.
Re:The Zen of Erlang (2016) by apta on Monday July 20, 2020 @12:14AM (#23894601)
As you point out, the JVM is getting preemption by means of Loom. .NET already has coroutines (async/await) so it should already do what you stated.
Re:The Zen of Erlang (2016) by smabie on Monday July 20, 2020 @02:42AM (#23895262)
I'm not super familiar with .NET, but if it supports preemption, they why this?

https://getakka.net/articles/concepts/actor-systems.html#blo...

Coroutines in general are a form of cooperative multi-tasking (they must explicitly yield), but I might missing something about .NET's implementation.

Re:The Zen of Erlang (2016) by apta on Monday July 20, 2020 @10:52AM (#23898395)
It is specific to blocking APIs, as per the page:

> Examples are legacy RDBMS drivers or messaging APIs, and the underlying reason is typically that (network) I/O occurs under the covers

The issue with async/await is that APIs need to be extended with their async counterparts. If they don't, then you have to be sure not to invoke blocking calls. Java won't have this issue as the runtime will take care of preemption.

Re:The Zen of Erlang (2016) by dnautics on Sunday July 19, 2020 @09:24PM (#23893864)
The concept of failure domains is baked into the runtime, and not an afterthought.
Re:The Zen of Erlang (2016) by yawaramin on Sunday July 19, 2020 @03:51PM (#23891966)
Check out the OP.
Re:The Zen of Erlang (2016) by danfritz on Sunday July 19, 2020 @10:09AM (#23889477)
Its already the biggest thing ever, but nobody knows it. 90% of the Internet nodes is controlled by erlang code [1]

Edit: it's indeed controlled nodes and not code

[1] https://thenewstack.io/why-erlang-joe-armstrongs-legacy-of-f...

Re:The Zen of Erlang (2016) by WJW on Sunday July 19, 2020 @10:39AM (#23889642)
If you use "passes through" as a standard, surely C would be the biggest thing ever since Linux+BSD+Windows make up way more than 99% of operating systems and those are all written in C.
Re:The Zen of Erlang (2016) by danfritz on Sunday July 19, 2020 @11:06AM (#23889834)
Ha yes fair point! I mainly wanted to indicate that it's used more than people think. It's the backbone of telecom
Re:The Zen of Erlang (2016) by bobbyz on Sunday July 19, 2020 @08:06PM (#23893493)
Erlang: Cobol/Telecom: Banks/Internet: Money
Re:The Zen of Erlang (2016) by pjmlp on Sunday July 19, 2020 @02:03PM (#23891110)
Windows has also a good part of C++ and we all know Microsoft's stance on keeping C compilers around.
Re:The Zen of Erlang (2016) by ori_b on Sunday July 19, 2020 @12:58PM (#23890618)
C is definitely bigger than people assume.
Re:The Zen of Erlang (2016) by ramchip on Sunday July 19, 2020 @11:33AM (#23890011)
It’s not exactly what the quote says - 90% of the traffic goes through nodes _controlled by Erlang_. See:

https://news.ycombinator.com/item?id=17218190

Re:The Zen of Erlang (2016) by danfritz on Sunday July 19, 2020 @11:57AM (#23890198)
Thanks for pointing that out, I've updated my original statement
Re:The Zen of Erlang (2016) by jlouis on Sunday July 19, 2020 @09:55AM (#23889380)
Arguably, it already is all over the place in telecommunication. But indeed, Huawei being somewhat limited could push more people to buy Ericsson equipment, where a large part of it uses Erlang.

It is strong in the area because you have the perfect storm of large complex protocols bundled with the need for very high reliability and robustness of systems. Few languages does that particular mix as well as Erlang.

Re:The Zen of Erlang (2016) by jmiskovic on Monday July 20, 2020 @04:32AM (#23895879)
I've spent two years with them and didn't see Erlang anywhere. It was occasionally mentioned as obscure thing you are forced to do in some other department, while rest considered themselves lucky to be using C++. There were also teams doing Java, Python, JS, Matlab, roughly in that order of popularity.
Re:The Zen of Erlang (2016) by brink on Sunday July 19, 2020 @12:23PM (#23890364)
My latest project is in Elixir after going through Rust and Python as candidates. Erlang / Elixir isn't the best candidate for _everything_, but I will be using it in the future for just about everything I can because of how much I like it.
Re:The Zen of Erlang (2016) by gregors on Sunday July 19, 2020 @10:57AM (#23889775)
I highly suggest looking at Elixir. It makes things much better in my opinion.

Some takes from one of the inventors of Erlang on Elixir https://joearms.github.io/published/2013-05-31-a-week-with-e...

tl;dr "It didn't take long, but pretty soon my gut feeling kicked in. This is good shit"

Re:The Zen of Erlang (2016) by danfritz on Sunday July 19, 2020 @11:22AM (#23889948)
Elixir is the only language that really blew my mind in its capabilities while still using a readable and fairly easy syntax.

Everything is just thinking in terms of message passing between lightweight processes

Re:The Zen of Erlang (2016) by swinglock on Sunday July 19, 2020 @06:06PM (#23892845)
I don't see why it would matter.

You're not going to see more or less Erlang anywhere, not even at Ericsson, due to Ericsson getting more or less business.

The software will be written regardless as long as there's some business and you're not going to notice outside Ericsson either way.

Besides, Huawei is free to use Erlang too. It stopped being Ericsson proprietary a long time ago.

Re:The Zen of Erlang (2016) by dnautics on Sunday July 19, 2020 @02:30PM (#23891332)
I don't think ericsson really uses erlang that much internally.
Re:The Zen of Erlang (2016) by mononcqc on Sunday July 19, 2020 @02:34PM (#23891357)
They do. It’s part of control planes for their next 5G stacks.