Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My point is, for an article about functional programming and Erlang, there wasn't any functional programming in Erlang.

The author pivoted from rejecting "change state of X" to advertising "change state of mailbox".

> the return value of both 'ping/1' and 'pong/0' are irrelevant because they are ignored If they were functional, they'd be optimised away by the compiler (for being irrelevant). They only exist for their side effects. Ping and pong are procedures. This is 100% imperative.



> there wasn't any functional programming ...This is 100% imperative

What distinction are you drawing between functional and imperative programming? This is not a trick question. Simon Peyton Jones has described Haskell as "the world's finest imperative programming language", and one way of interpreting my Haskell effect system Bluefin[1] is "purely functional imperative programming". I don't think functional and imperative are are mutually exclusive, in fact, I don't think they're even at odds. I think they're both at their best when combined.

[1] https://hackage.haskell.org/package/bluefin


> [ping and pong] only exist for their side effects.

Yes, these are really obviously two functions that exist to mutate state by printing to a console somewhere then communicating with another process.

> If they were functional, they'd be optimised away by the compiler (for being irrelevant).

I'd expect -say- Haskell to not optimize away functions that exist just to print to a console.

So, is your complaint that Erlang is (like Prolog) not a purely functional language, and that the author has asserted that Erlang is a functional language (in the same way that Prolog is) [0] but provided example code that produces side effects?

[0] Be very careful when reading here. I'm fairly aware of just how much Prolog is a functional language.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: