This bounty is no longer available
Web3 DAO | Ethereum Foundation Logo

[Docs] Style guidelines for recently added language features


Ethereum Foundation







Style Guide.


The Solidity Style Guide is not up to date with all the features added recently to the language. It needs to be updated


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:

  1. [ ] User defined value types,
  2. [ ] Custom errors,
  3. [ ] revert keyword vs the old revert() and require() functions,
  4. [ ] try..catch,
  5. [ ] Checked arithmetic,
  6. [ ] Declarations at file level (functions, constants, etc.),
  7. [ ] Immutable variables,
  8. [ ] override (in case where more than one base function is being overridden),
  9. [ ] calldata parameters,
  10. [ ] Function call options,
  11. [ ] 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.