Talk:Erlang (programming language)
From Wikipedia, the free encyclopedia
[edit] Name origin
I believe Erlang was ERgonomic LANGuage ? --> never heard about that
"Erlang is named after A. K. Erlang. It is sometimes mistakenly thought that its name is as abbreviation of ERicsson LANGuage, owing to its heavy use inside Ericsson."
Well, it's quite a pun because Erlang was created inside Ericsson, so its name is an abbreviation of ERicsson LANGuage too.
[edit] Movie
It looks like "Erlang the Movie" was taken down from the Erlang website, whether due to bandwidth cost or to sheer embarrassment it's not clear. If it ever shows up at some permanent-looking address, I recommend a link here. I do have a copy, but I'd rather not publish it myself (not least due to copyright concerns). --—Ashley Y 10:52, 2005 Apr 16 (UTC)
- I removed the link some time ago - after seeing the size of this monster, I guessed only few would appreciate it. What was content of this movie? --Pavel Vozenilek 16:12, 16 Apr 2005 (UTC)
-
- It explains the features of Erlang. They make them clear by an example with a telephone central. --Ejabberd 22:50, 16 Apr 2005 (UTC)
- There's a torrent of the movie available here: http://thepiratebay.org/details.php?id=3425809 -- Björn Lindström 22:55, 4 January 2006 (UTC)
- Google video has an 11 minute version. I don't know if it is the same as the downloadble one. http://video.google.com/videoplay?docid=-5830318882717959520 --Joshd 08:52, 4 June 2006 (UTC)
[edit] trapexit.org
I'd commented out link to this website: it looks dead, discussion forum is completely down. On main Erlang list I read that something there broke down in January and it doesn't seem to be fixed. When (if) the things will get better please uncomment the link. Thanks. Pavel Vozenilek 14:27, 19 February 2006 (UTC)
18 Aug 2006: I put in the link to www.trapexit.org as we have revived it :) /Mazen @ trapexit.org
[edit] Criticism, Review, Comparison?
I was hoping this page would tell me if the language was any good :) I wanted to see a criticism section, a brief mention of it's strengths and weakenesses, or a comparison to other languages used for the same purpose. Mathiastck 01:55, 23 June 2006 (UTC)
[edit] Haskell Roots?
Does Erlang have an Haskell roots? Looking at quicksort, I'd say so, but I don't know. If so, what are they? --69.61.168.145 02:01, 20 August 2006 (UTC)
- Erlang predates Haskell by almost a decade. The similarity you observe between quicksort implementations is most likely because both languages are functional programming languages that emphasize recursion and provide good list manipulation capabilities. --Allan McInnes (talk) 04:15, 20 August 2006 (UTC)
-
- Thanks for the info. Do you know if Haskell borrowed from Erlang? My comment was mostly a syntatic comment. Quicksort in Lisp/Scheme or OCaml look, syntatically, nothing like Erlang/Haskell, at least to me.--69.61.168.145 03:32, 23 August 2006 (UTC)
-
-
- Here is what the Erlang FAQ has to say about the syntax:
- 10.3 Where does Erlang syntax come from?
- Mostly from prolog. Erlang started life as a modified prolog. ! as the send-message operator comes from CSP. Eripascal was probably responsible for , and ; being separators and not terminators.
- —Tobias Bergemann 09:17, 23 August 2006 (UTC)
- Here is what the Erlang FAQ has to say about the syntax:
-
-
-
- The Haskell syntax is mostly borrowed from Miranda and Hope. Given their very different roots I would be surprised if there were any direct borrowings between Erlang and Haskell. — Tobias Bergemann 09:24, 23 August 2006 (UTC)
-
- List comprehensions came into Erlang from the Haskell direction. They could not be fit in exactly the same syntax but very similar (on the surface, strict/eager evaluation has implications in this area). —Preceding unsigned comment added by 194.237.142.7 (talk) 15:51, 5 March 2008 (UTC)
[edit] Armstrong's thesis
I've added a link to Armstrong's thesis, as it is an essential Erlang reading Dmitriid 12:02, 25 August 2006 (UTC)
[edit] Requested move
Erlang programming language → Erlang (programming language) – Conformance with WP naming conventions LotLE×talk
The page was moved. Move discussion is here: Wikipedia talk:WikiProject Programming languages/Renaming poll.
[edit] Mnesia
| Please help improve this article or section by expanding it. Further information might be found on the talk page or at requests for expansion. (January 2007) |
"Mnesia" redirects here, but this page does not explain it, and has a "see also" link to this redirect.
[edit] About typing
The article says Erlang uses single assignment and dynamic typing. Aren't these two characteristics mutually exclusive? --Pezezin 17:07, 18 November 2006 (UTC)
- No. Single assignment means that a name can have a value bound to it only once within a given scope. But it doesn't place any limits on what the type of the value being bound has to be. So I can write
-module(test). -export([testassign1/1, testassign2/1]). testassign1(A) -> B = A, B. testassign2(A) -> B = 1, B = A, B.
- and when I use these functions
testassign1works just fine for values of various types
Eshell V5.5 (abort with ^G)
1> c(test.erl).
{ok,test}
2> test:testassign1(256).
256
3> test:testassign1(3.1415927).
3.14159
4> test:testassign1("some text").
"some text"
- but
testassign2spits up an error, since it's trying to bind a value to B twice
6> test1:testassign2(256).
=ERROR REPORT==== 18-Nov-2006::18:33:41 ===
Error in process <0.31.0> with exit value: {{badmatch,256},[{test1,testassign2,1},{shell,exprs,6},{shell,eval_loop,3}]}
** exited: {{badmatch,256},
[{test1,testassign2,1},{shell,exprs,6},{shell,eval_loop,3}]} **
- As the example above shows, the function
testassign2will fail even when the type of the new value I'm trying to bind is the same as the type that B is already bound to. The error isn't a type error, it's an attempt to assign different values to B. The only timetestassign2doesn't generate an error is when the value passed to it is the same as the value it internally binds to B - in that case the second "assignment" simply confirms that B is already bound to '1'.
8> test1:testassign2(1). 1
- Dynamic typing means that the types of the values bound to a name aren't checked until runtime (dynamically). That means that I can write
-module(test).
-export([testtypes/1]).
testtypes(A) ->
B =
if
A > 0 ->
5;
A =< 0 ->
"some text"
end,
A + B.
- which sometimes binds the value '5' to the name 'B', and other times binds "some text" to 'B'. This will compile just fine (you can try it if you install Erlang).
Eshell V5.5 (abort with ^G)
1> c(test.erl).
{ok,test}
- But when I run the function
testtypesI get an error when I pass it negative values, since addition isn't defined for the the string type.
2> test:testtypes(3).
8
3> test:testtypes(-3).
=ERROR REPORT==== 18-Nov-2006::18:24:23 ===
Error in process <0.31.0> with exit value: {badarith,[{test,testtypes,1},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}
** exited: {badarith,[{test,testtypes,1},
{erl_eval,do_apply,5},
{shell,exprs,6},
{shell,eval_loop,3}]} **
- A statically checked language (like say Haskell) would have caught that problem at compile-time rather than runtime.
- Hope that clarifies things some. --Allan McInnes (talk) 01:51, 19 November 2006 (UTC)
[edit] Factorial
The factorial example,
fac(0) -> 1; fac(N) when N > 0 -> N * fac(N-1).
is overly complicated and does not use matching effectively. Is there anything wrong with this?
fac(0) -> 0; fac(1) -> 1; fac(N) -> N * fac(N - 1).
Aside from neither being tail recursive. --Mnp 18:15, 3 February 2007 (UTC)
- Well, the proposed change violates the 0! = 1 convention (see Factorial); it would, I think, be both simpler and more correct to simply use:
fac(0) -> 1; fac(N) -> N * fac(N-1).
- but the original version is still better, since neither the previously proposed change or the "simpler, more correct" version I give above will terminate if someone calls fac(N) with N<0. It might be even better to do something like:
fac(0) -> 1; fac(N) when N > 0, is_integer(N) -> N * fac(N-1).
- Except for the version proposed which gives 0! = 0, I don't have a real strong feeling as for what is best to use for encyclopedic purposes; its a matter of trade-off between clarity and robustness. I personally lean toward the last version I propose. It isn't the simplest, but I think it still is adequately clear to read, and demonstrates more, and works everywhere it should and errors immediately rather than getting stuck in infinite recursion (well, until it breaks since its not tail-recursive) when its called with an invalid value. A properly tail-recursive version would be the best implementation, of course, but probably overboard for the role of the example here. --Cmdicely 18:07, 13 April 2007 (UTC)
[edit] Clarification of which thread in Concurrency section
In the section on "Concurrency and distribution oriented language", one of the sentences is:
When the message is consumed (removed from the mailbox) the thread resumes execution.
However, it is not immediately clear whether this refers to the thread that sent the message or the thread that received the message. My initial thinking was that the thread that received the message had been looking for a matching message in the mailbox, hence this must tell me something about the sending thread. On reflection, I believe that this is not the intent and believe the article should work to make this clearer. (However, since I was reading the article in order to get some broad context before attempting to learn the language, it's likely that I would introduce inaccuracies if I attempted to edit this section.)
Additionally, as I re-read the section in putting together this note, I realize that I'm not clear as to whether there is an intent to draw a distinction between threads and processes or whether the terms apply interchangeably. I think the intent is the latter, but either way, the terminology should be made more clear.
Dsalex 02:17, 25 April 2007 (UTC)
[edit] Links to defmacro blog
A link to Erlang Style Concurrency has been added to the "Further reading" section a couple of times now. Aside from the fact that Wikipedia is not intended to be used as a way to advertise blogs, the article in question is a mix of a general history of concurrency, and a dicussion of how to implement Actor-model (i.e. "Eralng-style") concurrency in Java. While it's an interesting article, I don't think it's all that relevant to this article, since the only discussion it has of Erlang itself is fairly high-level (and already covered in more depth by other linked material). I'm willing to be convinced that this particular blog link merits inclusion in the article, but please don't add the link to defmacro again without discussing it here first. Thanks. --Allan McInnes (talk) 18:37, 31 May 2007 (UTC)
[edit] Possible Unintentional Copyright Violation?
I was just perusing Programming Erlang last night, and it seems to me the quicksort algorithm is very nearly lifted from the example in the book. Please note that I am not claiming this was intentional by the poster—in all likelihood it was not, as it seems to me there wouldn't be very many ways to implement this algorithm in a significantly different way (perhaps that's why it's a canonical example of Erlang programming?). Still, I know from experience that an algorithm is an algorithm is an algorithm, and it doesn't matter if you rediscover the same sequence of instructions or not, it could potentially still be a copyright-violation.
Someone more knowledgeable please advise. Thanks! Severoon 20:47, 30 July 2007 (UTC)
- Nope, that's not how copyright works. If you “rediscover” the sequence of instructions used in the book, you have the same rights to your version as the book authors have to theirs. It doesn't matter who thought of it first or who published their version first. Maybe you're confusing copyright and patents? --Levin 08:32, 16 September 2007 (UTC)
-
- Quicksort is almost as trivial an algorithm as "Hello World" and just as widely used to exemplify languages. There's nothing original to the erlang implementation either. —Preceding unsigned comment added by 87.162.25.50 (talk) 03:10, 14 April 2008 (UTC)
[edit] Concurrency with Erlang
Good link about the language, could be worked into the article. [1] Mathmo Talk 04:24, 19 September 2007 (UTC)

