-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[contract-deploy] Support multiple constructors in the same contract #4063
Comments
Should this be a compile time error? If you have multiple ctors? |
Not sure I understand the question. The idea is that you should be able to have multiple constructors in your code if you want, but you are only allowed to call one of them on each instance you've deployed. |
Ah as in whats the usecase where you are ok with having multiple constructors in one contract? |
Nothing you cannot do with a single constructor and a lot of conditionals, for sure. But it's pretty common for a language to support multiple constructors (though js and solidity don't). As an example, maybe having different constructors for an erc20 token, depending on whether there is initial minting or not? |
Actually nvm there are tons of usecases for multiple constructors. Java has this |
Closing as done |
As a nice-to-have, define multiple constructors in the same contract. These should all emit the same initialization nullifier. Test that, once a ctor has been called, the others cannot be called.
The text was updated successfully, but these errors were encountered: