[erlang-questions] Erlang newbie questions

CGS <>
Tue Oct 18 17:51:38 CEST 2011


Hi Garrett,

I think you misunderstood me. I specified that "Erlang application" does 
not refer to "OTP application". It's true that I haven't specified what 
exactly is "Erlang application" in my context, but at least I mentioned 
that it's not about "OTP application".

Nevertheless, your remark is correct that "single threaded" application 
can barely be considered as Erlang application, but, can anyone say you 
are not able to create a single threaded "Erlang application" by the 
mean of pure application and not as OTP designed it?

Just to give an example, I created a simple "application" which is not 
OTP and I am calling it from YAWS <erl> tag. The "application" (which 
consists in a single module with two functions) accepts entries, formats 
the entries and sends messages to a server (where I used the full OTP 
design). It is an application by definition (it can be used as 
independent entity - how you launch it does not matter here - and it has 
a specific task) even if it is few lines only. So, that's what I called 
"Erlang application" (disregarding what's behind gen_tcp). It is single 
threaded, so, here we are at my definition of "single threaded Erlang 
application".

I hope I was clear now and I apologize if I created any confusion. If my 
post still generates confusions, please, let me know.

Cheers,
CGS




On 10/18/2011 04:27 PM, Garrett Smith wrote:
> Hi CGS,
>
> On Tue, Oct 18, 2011 at 3:32 AM, CGS<>  wrote:
>> The main point for entering the discussion is the fact that many who replied
>> here were saying that if something crashes in your application doesn't kill
>> your application like in C. I beg to differ on this point. If your Erlang
>> application is single threaded, then your application (I do not speak here
>> about OTP application) will crash if an error occurs there.
> I'm inclined to argue that a "single threaded" application isn't a
> valid Erlang app :)
>
> I'll be slightly pedantic here -- just because I think it's worth mentioning...
>
> * When you run "erl" you start an OTP facility -- it's not an optional
> feature; it's fundamental to an Erlang system
>
> * A "single threaded" app would presumably be an app that's run using
> "erl" with -s or -eval. That'll work for running an application, but
> it's not the right way :)
>
> * The right way to run an Erlang app is to create an OTP application
> and include that app in a release, which is specified when you run
> "erl" with the -boot option
>
> If you run your Erlang application this way, you get all the benefits
> people have been describing.
>
> This is admittedly a bit of a bugaboo for me, but I think the
> dichotomy that people draw between "Erlang" and "OTP" is overall not
> helpful. The so called OTP patterns that are treated as
> optional/advanced are fundamental to the way the Erlang runtime is
> designed. So I tend to blur the two together into a single "Erlang" :)
>
> I think with some improvements in tooling and documentation, the
> headaches associated with using "OTP" will go away, which will be a
> huge boon for developers -- especially those new to Erlang.
>
> Garrett




More information about the erlang-questions mailing list