-
Website
http://humani.st/ -
Original page
http://humani.st/why-make-erlang-a-functional-language/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
saiyr
1 comment · 2 points
-
Alain O'Dea
3 comments · 1 points
-
beersage
2 comments · 2 points
-
Daniel Ha
8 comments · 405 points
-
mattrepl
1 comment · 2 points
-
-
Popular Threads
Why does Erlang copy data between functions and messages if it has immutable data? It seems like copying is only really required for isolation if data is mutable. I have read that it certain circumstances (large binaries or lists for example) that the arguments/messages use shared memory under the hood if the receiver is local.
I seem to remember going through these modules with you to see if anything would work. It was so long ago so I may remember wrong :)
The second point, I believe, is partly why Erlang has been so popular in industry: it's a small and simple language. Simple fine-grained explicit concurrency works well and composes well enough with a very shallow learning curve. This was done by focusing on a smaller problem set and cutting some of the functional features available in academic languages. Implicit concurrency, for instance, is still very academic and doesn't have the pragmatic efficiencies that I tried to highlight in the conclusion of my post. There are already many fully-featured functional languages out there and you see how well they've done in industry. Point taken, though.
Most functional languages start with abstraction and cut away until the hardware level is reached. Imperative languages tend to start with hardware and add abstraction. Erlang is one of the few functional languages that took the lessons of the highly abstracted functional languages and made it machine aware. Hybrids are the key and are why languages like Python and Ruby are becoming so popular.
Too bad Erlang sucks in the shootout. It gives some wrong signals about the language to newbies.
The name 'Hoersten' was mentioned during one of my employer's recent gatherings and I was curious if it's you. You know, the world's a small place sometimes. :-)
Also, Erlang's ugliness in referencing functions as arguments [2] is pretty annoying for a FP language.
__
[1] See Haskell, ML family, or Clojure.
[2] "fun someFn/<arity>" instead of "someFn". A good example of coding for the compiler.
This is usually demonstrated in the second version of factorial shown, the tail-recursive one.
Sorry for being so sarcastic here but this feature is so basic that to have missed it is really surprising.
so when they added closures to the language (see Armstrong's fascinating "History of Erlang"), these could naturally be assigned to (upper-case) variables and then referred to by same. but top-level functions, historically lower-cased and distinguishable from atoms only by the syntax of their use (function application versus argument-passing), had to have their names mangled (prefixed with "fun", etc.) in order to distinguish them when used as arguments.
(i don't know why the compiler is so lazy as to require that you specify the function arity.)
it seems the best solution would have been to leave Prolog behind and name functions in the same way as other variables, reserving a special naming convention for atoms. Common Lisp's ":foo" syntax is not bad, and would leave lower-case names for variables.
i'm also worried about the scope of Erlang's atoms -- instead of using them to distinguish record types, i would prefer abstract datatype constructors (ala ML or Haskell) that are assigned to variables and thus scoped like everything else so that software can be safely composable (are atoms universally scoped in Erlang?!) -- but maybe this is an important mechanism for making hot code-update feasible (i've used a similar mechanism to ease schema migration in persistent object databases).
I in fact agree that Erlang has a sub-par syntax but again, that wasn't the point of this post.
"In contemporary usage, 'begging the question' often refers to an argument where the premises are as questionable as the conclusion."
That's exactly the usage I intended. It's almost like complaining that a 5,000 page book's cover is too hard to look at when there are 5,000 pages of content behind it. The syntax (the premises) are just as questionable as the conclusion.