2 ms·
The *app.src file is used to store metadata about the application, and compilation will munge it a bit and copy it into your ebin directory (without the app.src
by lostcolony 12y ago
The *app.src file is used to store metadata about the application, and compilation will munge it a bit and copy it into your ebin directory (without the app.src bit I believe).
Essentially, it's what allows application:start(erl2048) to work. The {mod, {erl2048_app, []}} param is what indicates you want to run the code in erl2048_app.erl (though obviously the compiled beam file equivalent) as an application; the application behavior says that starting an application calls the equivalent start/# function.
So basically the order of startup when you call application:start(erl2048) is
Erlang looks for the munged erl2048.app.src, and loads that metadata.
The mod argument specifies a module to start.
The start function in that module is called (as it is expected to adhere to the application behavior). That function should start up the top level supervisor, which in turn is in charge of starting your entire supervisor heirarchy, and by extension, your actual worker processes.
- lostcolony 12y agoSome style stuff, for terseness, you can do things like change - move(left, State) -> move(getVector(left), State); move(right, State) -> move(getVector(right), State); move(up, State) -> move(getVector(up), State); move(down, State) -> move(getVector(down), State); move(Vector, State) -> ... to move(Direction, State) when is_atom(Direction) -> move(getVector(Direction), State); move(Vector, State) -> ...
- skazka16 12y agoohh, I see. So I can pass Direction as an atom now..that's cool. Thanks!