Elixir: Streamlined supervisor child_specs call start_link/1 instead of start_link/0

Created on 9 Aug 2017  路  1Comment  路  Source: elixir-lang/elixir

Environment

  • Elixir 1.5.1
  • Erlang/OTP 20.0
  • Operating system: macOS Sierra 10.12.6

Current behavior

When I currently define a child, using the older style of starting supervisor trees, using supervisor(MySup, []) the supervising process calls start_link/0 on the sub-supervisor.

When trying to use the streamlined child specs and just providing only the module name with no arguments to Supervisor.start_link, the supervising process calls start_link/1 explicitly with an empty list [].

Expected behavior

This is not _wrong_ I suppose but was surprising, since I would have expected it to function that same way given that I had not provided arguments to be passed to child_spec.

Most helpful comment

This is by design. The goal of the new child_spec is to always call start_link/1 by default and remove the "arguments dance" that we had in the past.

>All comments

This is by design. The goal of the new child_spec is to always call start_link/1 by default and remove the "arguments dance" that we had in the past.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

whitepaperclip picture whitepaperclip  路  3Comments

eproxus picture eproxus  路  3Comments

alexrp picture alexrp  路  4Comments

ericmj picture ericmj  路  3Comments

GianFF picture GianFF  路  3Comments