New to Elixir and loving it so far I’ve been making my way through Programming Elixir >= 1.6 by Dave Thomas and really liking the parts where he goes beyond just teaching you the language.
One of these parts is in Chapter 17 where he states that he likes to seperate the API, GenServer and Implementation specifics into seperate modules and files. I really like that too.
Hence, I implemented the exercise (the Stack GenServer built throughout Chapter 17) in that way as well. However, when you get to the next chapter (OTP: Supervisors) and want to supervise that GenServer by adding it to the children of a standard OTP application, there is a little bit of a hickup. This seems to be due to the split of the API and the GenServer.
My API (module Stack defined in stack.ex) contains:
My GenServer (module Stack.Server defined in stack/server.ex) contains:
Forgive me to cut to the chase, I can give more details later if needed, but the big question with “splitting this server up into a component” is: which of these do I pass as a child to my supervisor? (both give errors)"