[erlang-questions] application state

Jesper Louis Andersen <>
Thu Jul 21 00:11:35 CEST 2016


On Wed, Jul 20, 2016 at 10:08 PM, semmit mondo <>
wrote:

> What's the benefit of having application state returned in start(Type,
> Args) that is passed down to stop(State) in an OTP application module?  How
> is this useful?


Suppose you have some state which is dynamically generated when you start
the application, a Pid or Ref say. Since the data is dynamic, there is no
way you can "guess" it in the stop/1 function, so it must be passed along.
It is not that often I use this feature, but when I do, it is really nice
to have.


-- 
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160721/1141e716/attachment.html>


More information about the erlang-questions mailing list