Skip to content

Experiment with Designated Initializers in the repo for readability #471

@someone2639

Description

@someone2639

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)

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationhelp wantedExtra attention is neededlow priorityNon-urgent issue or feature / low priority

Type

No type

Projects

Status

To do

Relationships

None yet

Development

No branches or pull requests

Issue actions