-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Final/non-inheritable contracts #463
![:rage4: :rage4:](https://assets.fantasygmm.top/images/icons/emoji/rage4.png)
Comments
Guess it ties in with this: https://www.pivotaltracker.com/projects/1189488/stories/111152000, since it also has to do with whether or not something can be modified. Variables, functions, and contracts, code and storage. Messy hehe :D |
(i realize these are different things, but basically just looking at different ways things can be allowed to be extended/modified or not; functions, contracts, and variables) |
Maybe |
@androlo does the fact that libraries cannot inherit or be inherited helps this? |
No you can't put this type of code in libraries because they can just be used without extending at all (basically there's no language features that can stop someone from using a function that may conflict with normal code). The example is I make a contract with functions for writing directly to storage through assembly. If someone just extends the contract, or I put it in a library they can just link to, then they may then add new variables, and the auto allocation could conflict with the assembly routines that uses hard coded storage addresses, leading to weird errors. Maybe it's a documentation thing, or maybe this type of optimization is not really a good idea. Having |
This is something to consider, please let's keep this open. |
Do we agree to call this Would it reject the class to be subclassed or reject overriding defined functions? |
If it's called As a starting idea, in Remix could this be an error:
|
Not sure if this has been discussed before, but If we want to support auxiliary functions invoked from the constructor we would have to traverse the call graph though. |
|
I think applying |
Some notion of |
I don't think |
If that's the case, I think most uses of I think |
i guess it doesn't address this particular issue since people can still add new functions, but this seems like a non issue in the first place. never heard of someone getting bugs because of this. |
Closing after #5424 |
It is likely that people will use inline asm to create shortcuts around the standard storage and memory allocation procedures (I know i will). This could make the contract super efficient, but impossible (or at least dangerous) to extend. Maybe at some point there should be a flag that can be used to make contracts un-inheritable, like for example
final
is used for methods and classes in Java.The text was updated successfully, but these errors were encountered: