This is a constructor
in the old syntax. The name, MyToken
matches the name of the contract and this is therefore considered the constructor. Like this:
contract MyToken {
function MyToken( ...
This is the old system. This caused some errors on the part of developers, so more recent compilers use the constructor
keyword, like this:
contract MyToken {
constructor(...
Construtors are like init()
in other languages. They run exactly one time during deployment. They cannot run again and because of this, the constructor bytecode isn't even stored.
The pattern you see also uses inheritance and arguments passed into constructors. Suppose you have a contract DetailedERC20
and it's constructor takes some arguments (_name, _symbol, TOKEN_DECIMALS)
You also have MyToken
and it inherits from the first, like:
contract MyToken is DetailedERC20 { ...
MyToken
has a constructor that is taking some arguments. Some of those arguments need to passed through to DetailedERC20
's constructor so it will know what to do.
The first set of arguments (Registry _registry, string _name, string _symbol)
is declaring the function signature. Notice all the variables are typed. The second one is scooping up some of the defined inputs and passing them into the inherited constructor.
There is another example/explanation over here: Inherited Constructors
Hope it helps.