Live data from Hacker News

What can I only do in Erlang?

erlang.org

31–40 of 173 posts

Re: What can I only do in Erlang?

#31

Not sure I agree with the conclusions: 1. Binaries: this isn't really an issue. We ship the JVM with anything that we do in Java. Unzip, run, done. Go is probably ideal there but it doesn't support embedded resources without some hideous hacks so you're still going to be deploying more than just a single binary in a lot of cases. CLR is pretty good at this as well. 2. Sockets: 0MQ/WCF/JMS/any stream abstraction wired…

Comparing "features" side-by-side is a naive, "consumer-mindset" approach. Instead one should try to understand design-decisions and how they fit together - the subtleties. Devil is in the details.

For example, having an receive expression and pattern-matching and simple typing (like everything is a term - self-evaluating or an expression or a list of terms) makes your code shorter, self-evident, easy testable.

Now let's look one level down. Pattern-matching on binary data (alternative to costly parsing) is so quick that in OTP they do matching on TCP packets in real-time.

Conversion from terms to binary and back is also quick. So the the "central idiom" - message-passing - is just sending and receiving a list of terms (atoms) on a language-level (guarded pattern-matching, like on function arguments) while messages will be encoded into efficient binary form and delivered by Erlang's runtime.

Again, almost everything in Erlang fits together pretty well because it is layered system founded on proper principles and design decisions. Immutable data, share-nothing process isolation, light-weight processes, common and simple data-representation format based on simple types, pattern-matching on everything, etc.

It is almost like industry-strength Lisp system - a few layers of DSLs, using which one describes the real-world abstractions on different levels on different sub-languages (based on special forms and function composition).

gen_server is the most common example of such kind of "vertical" decomposition. You have to write only "pattern-matching on receive", while lower layers of abstraction (encoding, protocols) and upper levels (process supervision) are clearly separated with proper abstraction barriers.

Of course, it is possible to code something like this in Java, but there are the subtleties. GC for mutable data could not be as efficient as one for immutable data. No mutable state, no sharing, no locking, no problem. These aren't just slogans.

So, Erlang is a small language designed around proper concepts. It "wins" not only in terms of lines of code, but in efficiency, resource usage (Erlang runs on 16Mb RAM).

I could go on, but I hope the idea is already clear. It is not a "list of features" what matters, but which ones we have and especially don't have, and how they are fit together. In small mostly-functional languages like Lisps or Erlang or ML-family they fit perfectly.

http://www.erlang.org/doc/man/gen_server.html

Re: What can I only do in Erlang?

#32
post #27

Op's work environment is exceptional in many ways. It's a quintessential hacker work place. Unbelievable flexibility. I am sure a place like that attracts people who can make any technical edge, however miniscule, into a real felt advantage. I want to learn about their management, hiring and culture-building practices more than their actual hacking triumphs.

"As for encouraging adoption, I recommend you solve a problem in your spare time that your company has, in Erlang, and demonstrate how easy it is to maintain compared to whatever the accepted solution being worked on is. That's a lot safer thing to your management than "throwing money at a new toy, hoping for a payoff"."

For me, this translates to: invest unpaid time for your employer to improve things, on the off chance that it will be accepted. I understand where he's coming from, but that borders on self-exploitation.

Re: What can I only do in Erlang?

#33
post #13

Not sure I agree with the conclusions: 1. Binaries: this isn't really an issue. We ship the JVM with anything that we do in Java. Unzip, run, done. Go is probably ideal there but it doesn't support embedded resources without some hideous hacks so you're still going to be deploying more than just a single binary in a lot of cases. CLR is pretty good at this as well. 2. Sockets: 0MQ/WCF/JMS/any stream abstraction wired…

He's talking about dealing with binary data when he says 'binaries': http://www.erlang.org/doc/efficiency_guide/binaryhandling.ht... http://www.erlang.org/doc/programming_examples/bit_syntax.ht... Erlang is really strong for that. As to Java, sure, you can do anything with it, and do a decent job of it. But sometimes, as a startup, you are resource constrained, so if you can do more with less because you have a good…

I copied my OCaml bitmatch library from Erlang. It's a really great feature of Erlang.

https://code.google.com/p/bitstring/

Re: What can I only do in Erlang?

#34
Erlang looks interesting. However, the only problem I have with starting in Erlang is that on the great computer language shootout, it shows that Erlang is about 10x slower than C++ on most examples. And about 3x slower than Go [1] I know that the problems on this website are not specifically "concurrent" problems, but still, even a distributed web-server must do some non-concurrent stuff at times :) Are my concerns correct/justified?

[1] http://benchmarksgame.alioth.debian.org/u32q/benchmark.php?t...

Edit: even Haskell seems to be about 7x faster than Erlang (according to [1]). Suddenly, Haskell looks like a good candidate for writing a distributed server :) Can somebody comment on this?

Re: What can I only do in Erlang?

#35
post #34

Erlang looks interesting. However, the only problem I have with starting in Erlang is that on the great computer language shootout, it shows that Erlang is about 10x slower than C++ on most examples. And about 3x slower than Go [1] I know that the problems on this website are not specifically "concurrent" problems, but still, even a distributed web-server must do some non-concurrent stuff at times :) Are my concerns…

You wouldn't use Erlang for number crunching: you'd write some C code and communicate with that.

Same as you'd likely do with Ruby or PHP or whatever.

Re: What can I only do in Erlang?

#36
post #34

Erlang looks interesting. However, the only problem I have with starting in Erlang is that on the great computer language shootout, it shows that Erlang is about 10x slower than C++ on most examples. And about 3x slower than Go [1] I know that the problems on this website are not specifically "concurrent" problems, but still, even a distributed web-server must do some non-concurrent stuff at times :) Are my concerns…

When you say Erlang is slower than C++, You are right. It is also slower than Go.

Ruby is also slower than C++ & Go, But Ruby on Rails is not only popular but a very productive web framework which can help you build your app with a productivity that C++ or Go can't match.

When you write a high quality, fault tolerate system, the raw speed comes at the end. Erlang shines when you write a concurrent system plus its design is very unique. Erlang I would say isn't only a language but a whole philosophy of Software development. Once learned you can apply to many other platforms.

All in its a joy to work with functional languages and Erlang is perhaps the most commercially successful functional language.

Re: What can I only do in Erlang?

#37
post #35
post #34

Erlang looks interesting. However, the only problem I have with starting in Erlang is that on the great computer language shootout, it shows that Erlang is about 10x slower than C++ on most examples. And about 3x slower than Go [1] I know that the problems on this website are not specifically "concurrent" problems, but still, even a distributed web-server must do some non-concurrent stuff at times :) Are my concerns…

You wouldn't use Erlang for number crunching: you'd write some C code and communicate with that. Same as you'd likely do with Ruby or PHP or whatever.

Okay. But let's take the example of the C++ webserver framework written by Facebook employees, which was discussed here a few days ago, [1]. This project contains lots of protocol-handling logic for HTTP/1.1 and SPDY, and beneath that TLS.

Are you saying that such projects are better written in a combination of Erlang and C/C++?

[1] https://news.ycombinator.com/item?id=8563199

Re: What can I only do in Erlang?

#38

ZeroMQ gives you the same but better: messaging in any language. That means you can interface to any component you want written in any language you want. Also hiding native sockets, which means networking is not 1:1 but based on scalability patterns. At some point people will realize what a big deal that is.

Gives you the same what? I cannot think of a single feature overlap. ZeroMQ has nothing to say about supervisors, binary stream pattern matching, inspection, static analysis etc. Erlang has nothing to say about reliable messaging, message brokers, fan-out, routing and other patterns enabled with ZeroMQ. Yes there is the word "socket" in the post.

Re: What can I only do in Erlang?

#39
post #27

Op's work environment is exceptional in many ways. It's a quintessential hacker work place. Unbelievable flexibility. I am sure a place like that attracts people who can make any technical edge, however miniscule, into a real felt advantage. I want to learn about their management, hiring and culture-building practices more than their actual hacking triumphs.

"As for encouraging adoption, I recommend you solve a problem in your spare time that your company has, in Erlang, and demonstrate how easy it is to maintain compared to whatever the accepted solution being worked on is. That's a lot safer thing to your management than "throwing money at a new toy, hoping for a payoff"." For me, this translates to: invest unpaid time for your employer to improve things, on the off ch…

I agree that in an ideal situation you would get paid for coding up a prototype for the company.

On the other hand, if it gets accepted, there might be several benefits that could make the unpaid time worth it:

  * getting a raise or a promotion for the initiative
  * better work environment due to using the best tool for the job

Re: What can I only do in Erlang?

#40

Earlier quoted context omitted.

30 years?! Erlang was published internally by Ericsson in 1986, so you were (or know someone) on the original development team or among the first users?

Sorry, I may be assuming incorrectly. The person is in their 50s, and they're the most experienced developer I know (and can pick stuff up very quickly), so I assumed they'd have 30+ years of Erlang experience. It only dawned on me later that Erlang was only created in the 80s, so I must have misspoken, but yeah, my friend is one of the best developers I've had the pleasure of working with regardless.

And why isn't your friend finding a job with such a huge experience? I don't want to offend you, just plain curiosity.
Post reply on HN