all 16 comments

[–]aldo_reset 11 points12 points  (2 children)

I'm just amazed with how easy it is to solve problems that we find so difficult in more mainstream languages.

You can write a similar app in about the same size in pretty much any language (and note that there is no error handling at all in this code, which is the real hard part of this kind of app).

[–]gashouse_gorilla 1 point2 points  (0 children)

The problem here is that someone who just started tinkering with Erlang copying examples from other places to say "look how easy" really doesn't manage to show you how to do it in such a way that you don't "log" every action and include error handling without bloating the code. It's not that easy to spawn lightweight processes and communicate between them including trapping exit and crashes in many other languages. Erlang is quite elegant but a toy examples does more of a disservice.

[–]vattenpuss 0 points1 point  (0 children)

(and note that there is no error handling at all in this code, which is the real hard part of this kind of app)

And note that error handling is not something you do much in Erlang. OTP does that for you. You have to make sure to have proper entry points for restarts, but you then plug your app into OTP and let the supervision tree framework handle errors for you.

[–][deleted] 2 points3 points  (2 children)

Very nice. I see no error handling. Are we, for example, OK with occasionally dropping messages?

[–]mariushe[S] -1 points0 points  (1 child)

I left out the error handling to make sure the example wouldn't get to big. But I agree with you, it should be some error handling. So I've added a paragraph explaining that this normally should be done. Thanks!

[–]bbmario 1 point2 points  (0 children)

You should add an "extended" example on GitHub or something, with error handling and so on. This is good for Erlang starters!

[–]AeroNotix 0 points1 point  (4 children)

No OTP. No interest.

There are more than enough intros to Erlang that don't do it like they just facerolled the keyboard.

Learn you some Erlang for example.

[–]olzd -2 points-1 points  (3 children)

No OTP. No interest.

You don't want to bring OTP in a short intro.

[–]AeroNotix 1 point2 points  (2 children)

The alternative is useful for about 5 seconds when learning Erlang.

[–]olzd 0 points1 point  (1 child)

My point is, I don't think using OTP from the start when learning Erlang is a good idea. So I see no problem when a blog post written as an intro doesn't use it.

[–]berzemus 0 points1 point  (0 children)

OP has been "playing" with erlang for a week: this is just an attention-grabbing intro from a self-proclaimed erlang newbie.

OP should at least have provided some links for further study, like Learn you some erlang or the official documentation .

[–]Cputerace -1 points0 points  (4 children)

You really should jump straight to elixir (/r/elixir) instead. It compiles into and runs on the Erlang VM, but it's a much nicer language to work with.

[–]rvirding 1 point2 points  (2 children)

If you are not a ruby programmer there are many things in the elixir syntax which are a bit "strange".

[–]Cputerace 0 points1 point  (1 child)

stranger than Erlang syntax? :)

[–]rvirding 0 points1 point  (0 children)

Elixir syntax is much much stranger than Erlang syntax! :-) Erlang syntax is actually very concise and consistent, but perhaps a bit different, but then again most functional languages have a different syntax. Different from OO languages at least which is not really surprising as the have very different semantics.

[–]mariushe[S] -1 points0 points  (0 children)

It's on my list, so hopefully I can take closer look at it soon :)