Hi,
I’ve been learning Elixir and used this very good article by Jose: http://howistart.org/posts/elixir/1/index.html
I’m trying to understand what makes a difference with child specification. The official documentation is different from the article however the article’s version is the only one that works.
On supervisors it specifies children this way:
children = [
worker(Portal.Door, [])
]
Output is good:
{:ok, #PID<0.142.0>}
However trying any other specification from the official documentation:
%{
id: Portal.Door,
start: {Portal.Door, :start_link, [[]]}
}
children = [
Portal.Door
]
throws error:
{:error,
{:EXIT,
{:undef,
[
{Portal.Door, :start_link, [[], :orange], []},
{:supervisor, :do_start_child_i, 3, [file: 'supervisor.erl', line: 379]},
{:supervisor, :handle_call, 3, [file: 'supervisor.erl', line: 404]},
{:gen_server, :try_handle_call, 4, [file: 'gen_server.erl', line: 661]},
{:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 690]},
{:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}
]}}}
Based on the documentation I’d like to understand what is happening, why one works and how other specification types could be made to work as well.
Thanks for any answer! Cheers!