[erlang-questions] Time for OTP to be Renamed?

Loïc Hoguin essen@REDACTED
Thu Feb 13 12:01:33 CET 2014


No I'm serious, you can use Erlang without OTP. When the VM starts it 
loads the boot file which contains instructions on what modules to 
preload, what applications to start and so on. Make an empty boot file 
and look at what happens, most likely it will complain about the lists 
module missing. Then add your own lists module and try again. It will 
also complain about no error logger being present. Etc.

When the VM starts it creates process 0 that calls otp_ring0:start/2; 
don't let the name fool you, it's just an Erlang function that calls 
init:boot, which is the code that loads the boot file. The normal boot 
file then sets paths, loads all modules from kernel and stdlib and 
starts three additional processes: heart, error_logger and 
application_controller. But you don't actually need those.

The smallest boot script, that literally only loads the boot file and 
then sits there doing nothing, is this:

{script, {"Not OTP","1.2.3"}, [{path,["."]}, {primLoad, [lists]}]}.

As you can see I only add "." to the paths to load beam files from, and 
that's where I put my lists module. This module could very well have 
been one I wrote myself, and it could literally contain only the 
functions required, but for the sake of the example I just took the one 
from my install.

It's interesting because if you really want to you can have a very 
minimal VM that starts really fast (as has been proposed a few times to 
make rebar a little faster). Because the VM *does* starts *really* fast.

% time erl -boot test -run init stop
erl -boot test -run init stop  0.02s user 0.00s system 92% cpu 0.022 total

You could also create your own framework and use it instead of OTP. Even 
better, you could do something like Wayland is doing with Xorg, have 
your own framework be started as the "master" and then make it start OTP 
and make them run side by side.

It's only an interesting thought, of course, because it would take an 
immense amount of time to get it as reliable as OTP.

On 02/13/2014 10:51 AM, Garrett Smith wrote:
> Sigh. This *is* confusing. It just is.
>
> Loïc you *cannot* use Erlang without OTP. The VM starts a system,
> which consists of applications, which are supervisory trees of
> gen_servers.
>
> Supervisors are gen_servers btw.
>
> If you think OTP is optional, look at the first two lines of kernel.erl:
>
>      -module(kernel).
>      -behaviour(supervisor).
>
> Historically, OTP libraries came after Erlang the language, of course,
> but this so called OTP "framework" is now endemic to Erlang.
>
> What sucks IMO is that OTP is treated as "advanced" by the community
> and by book authors. I understand the history of this, but there's a
> cost: programmers delay learning core Erlang principles of
> *applications* -- i.e. supervisor trees -- because it's not taught up.
> It's also incredibly complicated, if you don't use e2.
>
> The irony is that *advanced* Erlang programmers can get away
> programming outside the OTP guard rails. Beginners should not even
> consider doing this until they understand why OTP works and why they
> should deviate.
>
> e2 helps, a lot.
>
> The whole point of e2 is to simplify the correct use of OTP -- letting
> programmers *start* with applications, supervisors and gen_servers (in
> e2 they're called services and tasks -- simple huh). I know it's
> controversial, but it's controversial to those who have been teaching
> Erlang while this stuff was being baked. I don't run into new learners
> who object to starting with OTP using e2 (though maybe they're just
> being polite -- if you're out there and had problems learning with e2,
> please drop me a line, or yell at me here).
>
> I agree wholeheartedly with Pieter. It's just Erlang. Keeping the term
> OTP is a historic vestige. We're used to it, but it's a dead weight
> that adds only confusion.
>
> The Ruby / Rails comparison is not accurate. It's more like Rails 1.0
> / Rails 2.0.
>
> Sadly though, I just don't see "OTP" going away because there's a
> trickle of noise from this list :|
>
> I make videos to cope.
>
> On Thu, Feb 13, 2014 at 2:54 AM, Ivan Uemlianin <ivan@REDACTED> wrote:
>> On 13/02/2014 08:13, Pieter Hintjens wrote:
>>>
>>> ... (a) stop using OTP as a
>>> confusing and needless synonym for Erlang, ...
>>
>>
>> Is that what OTP is used as?  I thought OTP was a set (or framework, or
>> platform) of libraries (behaviours, supervision, etc.) that facilitate the
>> development of highly scalable and reliable applications (telecoms-grade
>> scalability and reliability you might say).  AFAIK it's open-source.
>>
>> Yes, let's rename it to something that more closely reflects what it really
>> is.  How about the "Open-source Telecoms-grade reliability and scalability
>> Platform"?
>>
>> Ivan
>>
>>
>> --
>> ============================================================
>> Ivan A. Uemlianin PhD
>> Llaisdy
>> Speech Technology Research and Development
>>
>>                      ivan@REDACTED
>>                       www.llaisdy.com
>>                           llaisdy.wordpress.com
>>                github.com/llaisdy
>>                       www.linkedin.com/in/ivanuemlianin
>>
>>                          festina lente
>> ============================================================
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-questions mailing list