yaml-grammar
yaml-grammar copied to clipboard
Names for Rules Variables are difficult to understand in context
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:
- 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.
- 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:
n—currentIndentm—additionalIndentc—currentContextt—whitespaceTrim