tag:blogger.com,1999:blog-1595066899599866342.post7416910039768720050..comments2015-05-04T16:33:10.074+01:00Comments on Software Development Redux: The *Real* Erlang "Hello, World!"Edward Garsonhttp://www.blogger.com/profile/11435021961293665020noreply@blogger.comBlogger19125tag:blogger.com,1999:blog-1595066899599866342.post-47973303212200933302014-07-29T21:25:52.878+01:002014-07-29T21:25:52.878+01:00Most excellent! The idea of clearly demonstrating ...Most excellent! The idea of clearly demonstrating the mechanisms of Erlang's message passing, iteration, and decision processing done in a strong yet simple example.<br /><br />And, the fine quote, <b><i>"tail recursion is the bombay duck of computer science" </i></b> makes this one of the better short intros to Erlang.<br /><br />Thanks!!!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-15715973976057135982012-09-17T20:34:43.017+01:002012-09-17T20:34:43.017+01:00Notice that the simple
3> Pid ! hello.
Hello,...Notice that the simple<br /><br />3> Pid ! hello. <br />Hello, world!<br />hello<br /><br />can sometimes result in<br /><br />5> Pid ! hello. <br />hello<br />Hello, world!<br /><br />Why? concurrency! There is a race between printing the result of the io:format and the shell printing the result of the send expression...<br /><br /><br />Next feature to add is doing a software upgrade on the running process!<br />RogerLhttps://www.blogger.com/profile/05028866678859850147noreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-55796519501673063672011-04-13T17:42:15.479+01:002011-04-13T17:42:15.479+01:00I just installed erlang and your hello world progr...I just installed erlang and your hello world program is going to be my very first peace of code written in erlang. Thanks for the tutorial!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-37375434201557144442010-04-18T04:20:43.779+01:002010-04-18T04:20:43.779+01:00I believe that this is definitely a good hello wor...I believe that this is definitely a good hello world tutorial for Erlang. With the number of languages and the increasingly large amount of features they have, it is better to have a more verbose hello world that demonstrates more of the language syntax as opposed to a simple print statement. <br /><br />I propose that hello world be broken into a 2 step process. The first step would be following the original hello world standards, as in just printing something. This shows the basics and how to compile something in the language. The second step would be what you demonstrated here, a much more in-depth explanation of the language that has much more practical value to those who may actually use the language and stick with it.<br /><br />I definitely found this to be of value and was much easier to understand then another Erlang tutorial I previously found.<br /><br />-Nicholas BevacquaAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-24477385685581756682010-04-09T10:19:49.998+01:002010-04-09T10:19:49.998+01:00Thank you! Good approach.Thank you! Good approach.Kenneth Larssonnoreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-51480867300127128342009-07-21T23:06:52.515+01:002009-07-21T23:06:52.515+01:00Thanks for the detailed explanation of "Hello...Thanks for the detailed explanation of "Hello World"...It was a perfect introduction for myself, easing me into the world of Erlang. Not to shallow, not to deep.<br /><br />StuStu Thompsonhttps://www.blogger.com/profile/14537830625381588513noreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-87412261428609392422009-01-09T12:02:00.000+00:002009-01-09T12:02:00.000+00:00Really an easy example, thanksReally an easy example, thanksUnknownhttps://www.blogger.com/profile/11681069756457078977noreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-24379615064958006872008-11-10T23:02:00.000+00:002008-11-10T23:02:00.000+00:00Thanks for this small but useful article. I was tr...Thanks for this small but useful article. I was trying to understand the Pid and message sending from long time and after reading this, I really got it.<BR/><BR/>Thanks a lotAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-18170795832864126892008-06-29T20:49:00.000+01:002008-06-29T20:49:00.000+01:00Best Introduction for Erlang I ever seen.Thanks fo...Best Introduction for Erlang I ever seen.Thanks for it..you rockDhaneshhttps://www.blogger.com/profile/09444493181756345957noreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-31734056350044744632008-04-17T15:49:00.000+01:002008-04-17T15:49:00.000+01:00I would see it more like a "hello world in concurr...I would see it more like a <BR/>"hello world in concurrent programming" <BR/><BR/>or even, with minor modification "hello world in distributed programming"Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-44904929630709735722008-04-02T13:03:00.000+01:002008-04-02T13:03:00.000+01:00@anonymous:"It's also a great way to demonstrate m...@anonymous:<BR/><I>"It's also a great way to demonstrate memory leaks [...]"</I><BR/><BR/><B>Yes, that is absolutely true. Messages that do not match any of the receive clauses are moved to the process' save queue. When the process next receives a message, and <I>if that message matches</I>, then all the messages in the save queue are put back into the mailbox in the order in which they were received and reprocessed. The reason why is that the next received message can mutate the process in such a manner that messages that did not previously match would subsequently match (think guard statements for one). <BR/><BR/>The save queue works this way to enable flexibility with regards to message processing. And of course you would not design your system to send messages without expecting them to be processed at some point!<BR/><BR/>In any case, I could have added a third catch-all receive clause:<BR/><BR/>io:format("Neither 'hello' nor 'goodbye' received...")<BR/><BR/>Thank you for pointing this out.</B>Edward Garsonhttps://www.blogger.com/profile/11435021961293665020noreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-69741396410168644272008-04-02T12:22:00.000+01:002008-04-02T12:22:00.000+01:00Hi Edward, I would suggest making the example clea...Hi Edward, I would suggest making the example clearer by not giving the same names to functions and atoms. For example, call the atoms that hello() accepts "greet" and "leave" instead of "hello" and "goodbye" (and another benefit of that is that you can have the function print "Goodbye world!" to the screen when it receives the "leave" message).Immo Hünekehttps://www.blogger.com/profile/17107000566759440656noreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-62638514890242034762008-04-02T04:53:00.000+01:002008-04-02T04:53:00.000+01:00It's also a great way to demonstrate memory leaks,...It's also a great way to demonstrate memory leaks, since every message sent to Pid that isn't 'hello' or 'goodbye' will get stored in memory forever, or at least until loop() is shut down.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-78491558805488094802008-04-02T01:52:00.000+01:002008-04-02T01:52:00.000+01:00@anonymous:"Thank you for 'tail recursion is the b...<B>@anonymous:</B><BR/><I>"Thank you for 'tail recursion is the bombay duck of computer science'.<BR/><BR/>I doubt I'll ever properly attribute it, but I'll remember that forever."</I><BR/><BR/><B>Thanks for your kind comment. "You heard it here first!"</B><BR/>---<BR/><B>@keithb:</B><BR/><I>"Interesting proposal. It's not what "hello world" was invented for, though."</I><BR/><BR/><B>That's what "Hello, world" <I>may</I> have been invented for, but that has changed. In this day and age, we can reasonably expect the activities you cite to succeed without inordinate effort on the programmer's part.<BR/><BR/>I would say that "Hello world" has now rather become a means to understand how to perform those activities, and to provide some minimal insight into the programming language.<BR/><BR/>To quote Wikipedia (which we all know is the definitive source of All Things Correct ;-) <BR/><BR/><I>"Experienced programmers learning new languages can also gain a lot of information about a given language's syntax and structure from a hello world program."</I><BR/><BR/>From <A HREF="http://en.wikipedia.org/wiki/Hello_world_program" REL="nofollow">Hello world program</A></B><BR/>---<BR/>@anonymous:<BR/><I>"Thanks for the great intro to Erlang! [...]"</I><BR/><BR/><B>Glad you enjoyed it. Happy travels in Erlang-land!</B><BR/>---<BR/>@Robert Virding:<BR/><I>Unfortunately you are forgetting one thing [...] there is enough concurrency and actor stuff going on under the hood to make most people happy.</I><BR/><BR/><B>Great to have you by, Robert. <BR/><BR/><I>[Readers: Robert is the author of an Erlang book that predates the Prags book. And the author of Lisp-Flavored Erlang, a lisp syntax front-end to the Erlang compiler. That means he totally kicks Erlang ass.]</I><BR/><BR/>Thanks for the heads up; I wasn't aware that io:format() was so sophisticated under the covers.<BR/><BR/>However, I wouldn't expect most hackers to read the implementation of io:format() any more than reading the printf() implementation for a "Hello world" in C. <BR/><BR/>It's certainly a good idea, one that now I intend to follow up on.<BR/><BR/>Thank you for your comment.<BR/></B>Edward Garsonhttps://www.blogger.com/profile/11435021961293665020noreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-72055030227370775902008-04-01T21:11:00.000+01:002008-04-01T21:11:00.000+01:00Unfortunately you are forgetting one thing, while ...Unfortunately you are forgetting one thing, while the call to io:format may look like your typical "run of the mill standard sequential language do it all in one process function call", internally there is enough concurrency and actor stuff going on under the hood to make most people happy.Robert Virdinghttps://www.blogger.com/profile/16187415127098159771noreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-14831136539371850572008-04-01T20:21:00.000+01:002008-04-01T20:21:00.000+01:00Thanks for the great intro to Erlang! This was sim...Thanks for the great intro to Erlang! This was simple yet interesting enough to make me download Erlang and give it a try.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-6651914861399204782008-04-01T18:25:00.000+01:002008-04-01T18:25:00.000+01:00"I propose that the purpose of a "Hello, World!" p...<I><BR/>"I propose that the purpose of a "Hello, World!" program is to communicate something essential about the programming language in a small space."</I><BR/><BR/>Interesting proposal. It's not what "hello world" was invented for, though. <BR/><BR/>The original purpose of "hello world" was to have a suitably trivial item with which to check that one could successfully write, save, compile and execute a program <I>at all</I> in some new and unfamiliar programming environment. A new OS, or such like. <BR/><BR/>"Hello world" began as a smoke test for your ability to do any software development at all, and <A HREF="http://c2.com/cgi/wiki?HelloWorld" REL="nofollow">not</A> a language tutorial. The point being that the program itself should be about the least complex one that would actually cause an observable side-effect in the world, so one could focus on the oddities of the environment.keithbhttps://www.blogger.com/profile/14314542307822401015noreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-14296564266524177542008-04-01T17:54:00.000+01:002008-04-01T17:54:00.000+01:00Thank you for 'tail recursion is the bombay duck o...Thank you for 'tail recursion is the bombay duck of computer science'.<BR/><BR/>I doubt I'll ever properly attribute it, but I'll remember that forever.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1595066899599866342.post-4891630231294446852008-04-01T15:33:00.000+01:002008-04-01T15:33:00.000+01:00To be honest i find this rather veborse...shouldnt...To be honest i find this rather veborse...<BR/><BR/>shouldnt simple concepts stay simple even when they are translated into a new language's ecosystem?Anonymousnoreply@blogger.com