Skip to contentSkip to conversation

CODING_STYLE: Add a section of the naming convention

PATCH In review Julien Grall 4 participants 7 messages Dec 5, 2023 – Dec 7, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CODING_STYLE: Add a section of the naming convention

From: Julien Grall <[email protected]>

Several maintainers have expressed a stronger preference to use '-' when in filename and option that contains multiple words.

So document it in CODING_STYLE.

---
Changes in v2:
- New wording
- Update the section title
- Add Jan's acked-by

---
 CODING_STYLE | 9 +++++++++
 1 file changed, 9 insertions(+)
CODING_STYLE +9 -0
index ced3ade5a6fb..ed13ee2b664b 100644
@@ -144,6 +144,15 @@ separate lines and each line should begin with a leading '*'.
  * Note beginning and end markers on separate lines and leading '*'.
  */
 
+Naming convention for files and command line options
+----------------------------------------------------
+
+'-' should be used to separate words in commandline options and filenames.
+E.g. timer-works.
+
+Note that some of the options and filenames are using '_'. This is now
+deprecated.
+
 Emacs local variables
 ---------------------
 
Signature · 1 line
2.40.1
#1 lore raw
Quoted 26 lines · Julien Grall

From: Julien Grall <[email protected]>

Several maintainers have expressed a stronger preference to use '-' when in filename and option that contains multiple words.

So document it in CODING_STYLE.

---
Changes in v2:
- New wording
- Update the section title
- Add Jan's acked-by

---
 CODING_STYLE | 9 +++++++++
 1 file changed, 9 insertions(+)
CODING_STYLE +0 -0
index ced3ade5a6fb..ed13ee2b664b 100644
@@ -144,6 +144,15 @@ separate lines and each line should begin with a leading '*'.
  * Note beginning and end markers on separate lines and leading '*'.

CODING_STYLE separate lines and each line should begin with a leading '*'. · line 154

Quoted 10 lines
CODING_STYLE +8 -0
  */
 
+Naming convention for files and command line options
+----------------------------------------------------
+
+'-' should be used to separate words in commandline options and filenames.
+E.g. timer-works.
+
+Note that some of the options and filenames are using '_'. This is now
+deprecated.

Sorry for not catching this last time; "are using X" isn't really idiomatic English; more idiomatic would be something like the following:

"Note that some existing options and file names use '_'. This is now deprecated."

Since we're changing things, I *think* most style guides would advise against starting the sentence with a punctuation; so perhaps:

"Command-line options and file names should use '-' to separate words; e.g., timer-works."

And what about adding to the last paragraph:

"When touching code around command-line parameters still using '_', it is recommended to modify the documentation to say only '-', but modify the code to accept both '-' and '_' (for backwards compatibility)."

I was going to say I'm happy to change on check-in, but I think with three changes it's probably worth waiting for a fuller discussion.

-George

#2 lore raw
Quoted 48 lines · George Dunlap
Quoted 26 lines · Julien Grall

From: Julien Grall <[email protected]>

Several maintainers have expressed a stronger preference to use '-' when in filename and option that contains multiple words.

So document it in CODING_STYLE.

---
Changes in v2:
- New wording
- Update the section title
- Add Jan's acked-by

---
 CODING_STYLE | 9 +++++++++
 1 file changed, 9 insertions(+)
CODING_STYLE +0 -0
index ced3ade5a6fb..ed13ee2b664b 100644
@@ -144,6 +144,15 @@ separate lines and each line should begin with a leading '*'.
  * Note beginning and end markers on separate lines and leading '*'.

CODING_STYLE separate lines and each line should begin with a leading '*'. · line 154

Quoted 10 lines
CODING_STYLE +8 -0
  */
 
+Naming convention for files and command line options
+----------------------------------------------------
+
+'-' should be used to separate words in commandline options and filenames.
+E.g. timer-works.
+
+Note that some of the options and filenames are using '_'. This is now
+deprecated.

Sorry for not catching this last time; "are using X" isn't really idiomatic English; more idiomatic would be something like the following:

"Note that some existing options and file names use '_'. This is now deprecated."

Since we're changing things, I *think* most style guides would advise against starting the sentence with a punctuation; so perhaps:

Quoted 8 lines

"Command-line options and file names should use '-' to separate words; e.g., timer-works."

And what about adding to the last paragraph:

"When touching code around command-line parameters still using '_', it is recommended to modify the documentation to say only '-', but modify the code to accept both '-' and '_' (for backwards compatibility)."

In this context see
https://lists.xen.org/archives/html/xen-devel/2020-01/msg01945.html
and Andrew's response
https://lists.xen.org/archives/html/xen-devel/2020-01/msg02006.html
I'm still in favor of addressing the issue centrally (making unnecessary adjustments like you suggest in the new paragraph). Yet I think Andrew's objection would cover such adjustments as much as my generic solution.

Jan

#3 lore raw
Quoted 55 lines · Jan Beulich
Quoted 46 lines · George Dunlap
Quoted 25 lines · Julien Grall

From: Julien Grall <[email protected]>

Several maintainers have expressed a stronger preference to use '-' when in filename and option that contains multiple words.

So document it in CODING_STYLE.

---
Changes in v2:
- New wording
- Update the section title
- Add Jan's acked-by

---
 CODING_STYLE | 9 +++++++++
 1 file changed, 9 insertions(+)
CODING_STYLE +0 -0
index ced3ade5a6fb..ed13ee2b664b 100644
@@ -144,6 +144,15 @@ separate lines and each line should begin with a leading '*'.
  * Note beginning and end markers on separate lines and leading '*'.

CODING_STYLE separate lines and each line should begin with a leading '*'. · line 154

Quoted 10 lines
CODING_STYLE +8 -0
  */
 
+Naming convention for files and command line options
+----------------------------------------------------
+
+'-' should be used to separate words in commandline options and filenames.
+E.g. timer-works.
+
+Note that some of the options and filenames are using '_'. This is now
+deprecated.

Sorry for not catching this last time; "are using X" isn't really idiomatic English; more idiomatic would be something like the following:

"Note that some existing options and file names use '_'. This is now deprecated."

Since we're changing things, I *think* most style guides would advise against starting the sentence with a punctuation; so perhaps:

Quoted 8 lines

"Command-line options and file names should use '-' to separate words; e.g., timer-works."

And what about adding to the last paragraph:

"When touching code around command-line parameters still using '_', it is recommended to modify the documentation to say only '-', but modify the code to accept both '-' and '_' (for backwards compatibility)."

Quoted 7 lines

In this context see
https://lists.xen.org/archives/html/xen-devel/2020-01/msg01945.html
and Andrew's response
https://lists.xen.org/archives/html/xen-devel/2020-01/msg02006.html
I'm still in favor of addressing the issue centrally (making unnecessary adjustments like you suggest in the new paragraph). Yet I think Andrew's objection would cover such adjustments as much as my generic solution.

Aliasing - and _ in the cmdline parsing breaks basic usability.

Its fine for new options to use -, and it's even fine-ish (but only if you're going to be the one doing security backports) to rename internal files.

But there is real and detrimental effect for altering the command line.

You will get people failing to express the option they intended when working with an older form of Xen.  You will need an absurd number of notes in the command line docs saying "newer versions of Xen accept an alias but you need to use the underscore form for backwards compatibility".

Not to mention that there are years of notes scattered all around the internet using the underscore forms, so it's likely that everyone will continue to use the underscore form, meaning that you don't even have a way to phase them out.

And for what?  An attempt to pretend that we don't have 2 decades of history where underscores where the norm?

It's tinkering, for no useful benefit and a clear cost.

~Andrew

#4 lore raw

Hi,

Quoted 82 lines · Andrew Cooper
Quoted 55 lines · Jan Beulich
Quoted 46 lines · George Dunlap
Quoted 25 lines · Julien Grall

From: Julien Grall <[email protected]>

Several maintainers have expressed a stronger preference to use '-' when in filename and option that contains multiple words.

So document it in CODING_STYLE.

---
Changes in v2:
- New wording
- Update the section title
- Add Jan's acked-by

---
  CODING_STYLE | 9 +++++++++
  1 file changed, 9 insertions(+)
CODING_STYLE +0 -0
index ced3ade5a6fb..ed13ee2b664b 100644
@@ -144,6 +144,15 @@ separate lines and each line should begin with a leading '*'.
   * Note beginning and end markers on separate lines and leading '*'.

CODING_STYLE separate lines and each line should begin with a leading '*'. · line 154

Quoted 10 lines
CODING_STYLE +8 -0
   */
 
+Naming convention for files and command line options
+----------------------------------------------------
+
+'-' should be used to separate words in commandline options and filenames.
+E.g. timer-works.
+
+Note that some of the options and filenames are using '_'. This is now
+deprecated.

Sorry for not catching this last time; "are using X" isn't really idiomatic English; more idiomatic would be something like the following:

"Note that some existing options and file names use '_'. This is now deprecated."

Since we're changing things, I *think* most style guides would advise against starting the sentence with a punctuation; so perhaps:

Quoted 8 lines

"Command-line options and file names should use '-' to separate words; e.g., timer-works."

And what about adding to the last paragraph:

"When touching code around command-line parameters still using '_', it is recommended to modify the documentation to say only '-', but modify the code to accept both '-' and '_' (for backwards compatibility)."

Quoted 7 lines

In this context see
https://lists.xen.org/archives/html/xen-devel/2020-01/msg01945.html
and Andrew's response
https://lists.xen.org/archives/html/xen-devel/2020-01/msg02006.html
I'm still in favor of addressing the issue centrally (making unnecessary adjustments like you suggest in the new paragraph). Yet I think Andrew's objection would cover such adjustments as much as my generic solution.

Aliasing - and _ in the cmdline parsing breaks basic usability.

Its fine for new options to use -, and it's even fine-ish (but only if you're going to be the one doing security backports) to rename internal files.

But there is real and detrimental effect for altering the command line.

You will get people failing to express the option they intended when working with an older form of Xen.  You will need an absurd number of notes in the command line docs saying "newer versions of Xen accept an alias but you need to use the underscore form for backwards compatibility".

Not to mention that there are years of notes scattered all around the internet using the underscore forms, so it's likely that everyone will continue to use the underscore form, meaning that you don't even have a way to phase them out.

Quoted 4 lines

And for what?  An attempt to pretend that we don't have 2 decades of history where underscores where the norm?

It's tinkering, for no useful benefit and a clear cost.

+1 with what Andrew said.

Cheers,

Signature · 1 line
Julien Grall
#5 lore raw
Quoted 86 lines · Julien Grall

Hi,

Quoted 82 lines · Andrew Cooper
Quoted 55 lines · Jan Beulich
Quoted 46 lines · George Dunlap
Quoted 25 lines · Julien Grall

From: Julien Grall <[email protected]>

Several maintainers have expressed a stronger preference to use '-' when in filename and option that contains multiple words.

So document it in CODING_STYLE.

---
Changes in v2:
- New wording
- Update the section title
- Add Jan's acked-by

---
  CODING_STYLE | 9 +++++++++
  1 file changed, 9 insertions(+)
CODING_STYLE +0 -0
index ced3ade5a6fb..ed13ee2b664b 100644
@@ -144,6 +144,15 @@ separate lines and each line should begin with a leading '*'.
   * Note beginning and end markers on separate lines and leading '*'.

CODING_STYLE separate lines and each line should begin with a leading '*'. · line 154

Quoted 10 lines
CODING_STYLE +8 -0
   */
 
+Naming convention for files and command line options
+----------------------------------------------------
+
+'-' should be used to separate words in commandline options and filenames.
+E.g. timer-works.
+
+Note that some of the options and filenames are using '_'. This is now
+deprecated.

Sorry for not catching this last time; "are using X" isn't really idiomatic English; more idiomatic would be something like the following:

"Note that some existing options and file names use '_'. This is now deprecated."

Since we're changing things, I *think* most style guides would advise against starting the sentence with a punctuation; so perhaps:

Quoted 8 lines

"Command-line options and file names should use '-' to separate words; e.g., timer-works."

And what about adding to the last paragraph:

"When touching code around command-line parameters still using '_', it is recommended to modify the documentation to say only '-', but modify the code to accept both '-' and '_' (for backwards compatibility)."

Quoted 7 lines

In this context see
https://lists.xen.org/archives/html/xen-devel/2020-01/msg01945.html
and Andrew's response
https://lists.xen.org/archives/html/xen-devel/2020-01/msg02006.html
I'm still in favor of addressing the issue centrally (making unnecessary adjustments like you suggest in the new paragraph). Yet I think Andrew's objection would cover such adjustments as much as my generic solution.

Aliasing - and _ in the cmdline parsing breaks basic usability.

Its fine for new options to use -, and it's even fine-ish (but only if you're going to be the one doing security backports) to rename internal files.

But there is real and detrimental effect for altering the command line.

You will get people failing to express the option they intended when working with an older form of Xen. You will need an absurd number of notes in the command line docs saying "newer versions of Xen accept an alias but you need to use the underscore form for backwards compatibility".

Not to mention that there are years of notes scattered all around the internet using the underscore forms, so it's likely that everyone will continue to use the underscore form, meaning that you don't even have a way to phase them out.

Quoted 6 lines
Quoted 4 lines

And for what? An attempt to pretend that we don't have 2 decades of history where underscores where the norm?

It's tinkering, for no useful benefit and a clear cost.

+1 with what Andrew said.

Haven't given it full thought, because I absolutely did not want to make this change take longer to get in. :-). The existence of disagreement is enough for me to withdraw my suggestion.

-George

#6 lore raw

Hi George,

Quoted 90 lines · George Dunlap
Quoted 89 lines · Julien Grall

Hi,

Quoted 85 lines · Andrew Cooper
Quoted 55 lines · Jan Beulich
Quoted 46 lines · George Dunlap
Quoted 25 lines · Julien Grall

From: Julien Grall <[email protected]>

Several maintainers have expressed a stronger preference to use '-' when in filename and option that contains multiple words.

So document it in CODING_STYLE.

---
Changes in v2:
- New wording
- Update the section title
- Add Jan's acked-by

---
   CODING_STYLE | 9 +++++++++
   1 file changed, 9 insertions(+)
CODING_STYLE +0 -0
index ced3ade5a6fb..ed13ee2b664b 100644
@@ -144,6 +144,15 @@ separate lines and each line should begin with a leading '*'.
    * Note beginning and end markers on separate lines and leading '*'.

CODING_STYLE separate lines and each line should begin with a leading '*'. · line 154

Quoted 10 lines
CODING_STYLE +8 -0
    */
 
+Naming convention for files and command line options
+----------------------------------------------------
+
+'-' should be used to separate words in commandline options and filenames.
+E.g. timer-works.
+
+Note that some of the options and filenames are using '_'. This is now
+deprecated.

Sorry for not catching this last time; "are using X" isn't really idiomatic English; more idiomatic would be something like the following:

"Note that some existing options and file names use '_'. This is now deprecated."

Since we're changing things, I *think* most style guides would advise against starting the sentence with a punctuation; so perhaps:

Quoted 8 lines

"Command-line options and file names should use '-' to separate words; e.g., timer-works."

And what about adding to the last paragraph:

"When touching code around command-line parameters still using '_', it is recommended to modify the documentation to say only '-', but modify the code to accept both '-' and '_' (for backwards compatibility)."

Quoted 7 lines

In this context see
https://lists.xen.org/archives/html/xen-devel/2020-01/msg01945.html
and Andrew's response
https://lists.xen.org/archives/html/xen-devel/2020-01/msg02006.html
I'm still in favor of addressing the issue centrally (making unnecessary adjustments like you suggest in the new paragraph). Yet I think Andrew's objection would cover such adjustments as much as my generic solution.

Aliasing - and _ in the cmdline parsing breaks basic usability.

Its fine for new options to use -, and it's even fine-ish (but only if you're going to be the one doing security backports) to rename internal files.

But there is real and detrimental effect for altering the command line.

You will get people failing to express the option they intended when working with an older form of Xen. You will need an absurd number of notes in the command line docs saying "newer versions of Xen accept an alias but you need to use the underscore form for backwards compatibility".

Not to mention that there are years of notes scattered all around the internet using the underscore forms, so it's likely that everyone will continue to use the underscore form, meaning that you don't even have a way to phase them out.

And for what? An attempt to pretend that we don't have 2 decades of history where underscores where the norm?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

It's tinkering, for no useful benefit and a clear cost.

+1 with what Andrew said.

Haven't given it full thought, because I absolutely did not want to make this change take longer to get in. :-). The existence of disagreement is enough for me to withdraw my suggestion.

Thanks. I will commit the patch soon then. I am happy to continue the discussion though. I would love to get the file CODING_STYLE reflecting more our style policies :).

Cheers,

Signature · 1 line
Julien Grall