cxw42 / toolconfig-core-py

ToolConfig core in Python
https://github.com/editorconfig/editorconfig/issues/482
Other
0 stars 0 forks source link

Hyphen or Dot Separators? #6

Open benjamin-kirkbride opened 1 year ago

benjamin-kirkbride commented 1 year ago

At the top of https://github.com/editorconfig/editorconfig/issues/482 there is an example toolconfig that contains this snippet:

# A custom property with a simple value --- a clang-format(1) option
'.org.llvm.clang.AlignOperands' = 'AlignAfterOperator'

Note the use of dots as separators.

Then below this is said:

.... This is a major change from EditorConfig files. Cores shall accept keys that:

  • are defined in the specification (bare keys); or
  • are in reverse-DNS form but using hyphens as the separators

and no others. In particular, dotted keys shall not be accepted.

Keys are distinguished by the presence of hyphens and underscores:

  • Keys defined in the specification may use underscores and may not use hyphens.
  • Keys in reverse-DNS form must use hyphens and may not use underscores.

Rationale:

  • Restricting bare keys to those in the specification means the standard set of keys will not grow to include keys that we effectively have to support in all plugins because they are widely used (“Hyrum’s Law”). XKCD
  • Permitting reverse-DNS keys means that users can name their own keys using their own domain names and not collide with other users' keys.
  • Using hyphens instead of dots for reverse-DNS key names keeps the single-level structure clear — the reverse-DNS key name is a single entity, not a hierarchical structure of tables. ...

Originally posted by @cxw42 in https://github.com/editorconfig/editorconfig/issues/482#issuecomment-1403023825

My assumption is that dots were initially conceived, then it was decided hyphens would be prefered.


My opinion:

benjamin-kirkbride commented 1 year ago

Also, I think, that while technically to spec, requiring the preceding dot to represent a "true" FQDN is a battle that is already lost, and is not a hill worth dying on here.

cxw42 commented 1 year ago

dots were initially conceived, then it was decided hyphens would be prefered.

Yes

hyphens can exist in domain names

This is a good point I hadn't thought of.

requiring the preceding dot to represent a "true" FQDN

The preceding dot was actually not related to FQDN --- it was to prevent an unquoted dotted key from being valid TOML :)

benjamin-kirkbride commented 1 year ago

The preceding dot was actually not related to FQDN --- it was to prevent an unquoted dotted key from being valid TOML :)

I see, well as stated above, I'm of the opinion that this would be a feature and not a bug :)