small medium large xlarge

12 Feb 2018, 04:46
Brian Strecker (1 post)

on p 115 of P1.0, the function call

iex> {:ok, game} = GameSupervisor.start_game(“Cassatt”)

fails with an undef {IslandsEngine.Game, :start_link, [[], “Cassatt”], []} error when I try it.

I can get this function call to work by adding

def start_link([], name), do: start_link(name)

to the IslandsEngine.Game module to redirect the function call to the existing Game.start_link/1 function.

I’m still working to gain a solid understanding of the Supervisor/Worker interactions in OTP and am concerned that I’m missing something, since the discussions topics and errata haven’t addressed this error—at least that I’ve been able to find.

The documentation for Supervisor in Elixir 1.5 says that In the case of :simple_one_for_one, the child specification defined in the supervisor is used and instead of a child_spec, an arbitrary list of terms is expected. The child process will then be started by appending the given list to the existing function arguments in the child specification.

It looks like this may be what is happening. Is there more going on here?

You must be logged in to comment