From 18a160e0e98955f95dd51f8ccc8b9c27cd99a0a8 Mon Sep 17 00:00:00 2001 From: sideshowbarker Date: Tue, 25 Feb 2025 14:24:52 +0900 Subject: [PATCH] Docs: Prefer closely matching explicit spec AO names --- Documentation/CodingStyle.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/CodingStyle.md b/Documentation/CodingStyle.md index 3d57505f2f1..e2642fb7276 100644 --- a/Documentation/CodingStyle.md +++ b/Documentation/CodingStyle.md @@ -35,6 +35,22 @@ class Filedescriptor; String MIME_Type(); ``` +When implementing spec algorithms and other constructs that a spec explicitly names, prefer closely matching the same names the spec uses, whenever possible. + +Given the construct at https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-being-missing which has the literal name _“Suffering from being missing”_ in the spec, for example: + +###### Right: + +```c++ +bool HTMLInputElement::suffering_from_being_missing(); // exactly matches the spec naming +``` + +###### Wrong: + +```c++ +bool HTMLInputElement::has_missing_constraint(); // arbitrarily differs from spec naming +``` + Use full words, except in the rare case where an abbreviation would be more canonical and easier to understand. ###### Right: