In all the cases where something is to be started, supervisor, application and proc_lib, the specifier for this is the Mod,Fun,Args of apply and spawn. Though I will admit that in the application case the function name is predefined, almost like a call back function. And for callbacks all the arguments, number and meaning, are predefined.
I personally think the main problems are:
- Inconsistency in the documentation caused by using "Args" to mean different things. So in supervisor. application and proc_lib "Args" really is a list of arguments in apply/spawn style where the call is built using the length of the list to determine the arity of the called function. In gen_XXX the ONE argument to Mod:init/1 is also called "Args" where it can be anything and even if it is a list it will only become one argument. Calling it "Data" would have made it easier to understand.
- The second argument supervisor:start_child/2 to completely different, both type and meaning, depending on whether the supervisor is a simple_one_for_one or anything else. Yes, I know that it is documented but it IS inconsistent.
I think that in general making all the start functions arity 1 and calling them with a list of arguments is of no real benefit. Apart from simple_one_for_one supervisors the arguments to the start function are anyway fixed so there would be no real gain here anyway.
Also it would be a completely backwards incompatible change which would cause a lot of rewriting, so I don't see it being applied.
We will just have to live with it. If it is of any consolation there are changes I would like to make which would also never be made. :-)
Robert
Perhaps a better name for what you send to Mod:init/1 in gen_XXX is "Argument"
so it's more clear from the variable name that it is a single term.
// Gustav
Sent from my PC
Anything but "Args" as ther is realy only one of it.
I honestly have no idea how often simple_one_for_one is actually used. Or if people use the other restart types and use start_child/2 with a child spec. It would be interesting to find out.
Robert
----- Original Message -----
>