yaml-grammar icon indicating copy to clipboard operation
yaml-grammar copied to clipboard

Names for Rules Variables are difficult to understand in context

Open aSemy opened this issue 1 year ago • 0 comments

The spec describes 4 rule variables, n, m, c, and t.

  • https://github.com/yaml/yaml-grammar/blob/15047828ace28d09594d3553b90b165fef60634b/yaml-spec-1.2.yaml#L91
  • https://github.com/yaml/yaml-grammar/blob/15047828ace28d09594d3553b90b165fef60634b/yaml-spec-1.2.yaml#L93
  • https://github.com/yaml/yaml-grammar/blob/15047828ace28d09594d3553b90b165fef60634b/yaml-spec-1.2.yaml#L95
  • https://github.com/yaml/yaml-grammar/blob/15047828ace28d09594d3553b90b165fef60634b/yaml-spec-1.2.yaml#L103

I find a terse, single letter, variable in the spec difficult for two reasons:

  1. When looking at the rules, it is difficult to remember what each letter means. If the variables were named with a brief summary of the actual value, it would be easier to remember the actual meaning.
  2. The short names make searching for usages impossible. If the names were distinct, then it would be possible to quickly find usages and the definition.

I would find the spec easier to understand if the names were more descriptive. For example:

  • ncurrentIndent
  • madditionalIndent
  • ccurrentContext
  • twhitespaceTrim

aSemy avatar Apr 13 '24 11:04 aSemy