Skip to content
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

Experiment with Designated Initializers in the repo for readability #471

Open
someone2639 opened this issue Aug 3, 2022 · 0 comments
Open
Assignees
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed low priority Non-urgent issue or feature / low priority
Milestone

Comments

@someone2639
Copy link
Collaborator

referencing this document

On some tables/structs in the repo, having an explicit note of what the data corresponds to will be very beneficial to readability in my opinion.

Benefits:

  • Allows out-of-order struct and array initialization
  • No need to cross-reference struct/array definitions

Downsides:

  • If this were to affect the entire repo, in some small cases it's more work than it's worth (the Linux kernel has a ton of examples where for the sake of readability they create an enum for a 3-element array that is never used anywhere else)
  • New users might be confused on the syntax at first (even I was when I first saw it on an array in Linux)

Therefore I only envision this being useful in certain cases where readability takes a hit (looking at #467)

@someone2639 someone2639 added documentation Improvements or additions to documentation help wanted Extra attention is needed low priority Non-urgent issue or feature / low priority labels Aug 3, 2022
@someone2639 someone2639 self-assigned this Aug 3, 2022
@gheskett gheskett added this to the 2.2 milestone Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed low priority Non-urgent issue or feature / low priority
Projects
Status: To do
Development

No branches or pull requests

2 participants