Page
Abstract
The Solidity Style Guide is not up to date with all the features added recently to the language. It needs to be updated
Details
There are now good linters available, such as solhint so I have doubts whether maintaining detailed guidelines independently of them is worth the effort. I think that having some general recommendations would be enough and the rest should be deferred to such tools. Still, as long as these guidelines are in the docs, they should at least be kept up to date.
The task here is to check, for each feature from the list below, if any of the existing recommendations should mention that feature, and whether a completely new section is needed. Then to create a PR (one per feature) with proposed new recommendations so that we can discuss them in more detail.
The priority should be to keep the recommendations concise and fairly general. Where possible, the existing text should be simplified. In cases that are currently underspecified we will need to come up with new rules - in those cases following the practices already established in the ecosystem or recommended by existing tools should be preferred over inventing something completely new.
Features with missing guidelines
Here's an initial list of features that are either not mentioned at all of mentioned only briefly in the guide:
- [ ] User defined value types,
- [ ] Custom errors,
- [ ]
revert
keyword vs the oldrevert()
andrequire()
functions, - [ ]
try
..catch
, - [ ] Checked arithmetic,
- [ ] Declarations at file level (functions, constants, etc.),
- [ ] Immutable variables,
- [ ]
override
(in case where more than one base function is being overridden), - [ ]
calldata
parameters, - [ ] Function call options,
- [ ] Pragmas (version, ABIEncoder, SMTChecker).
The list is not exhaustive, there are very likely some features missing. Feel free to edit this description to add them or post them in the comments.