Thanks for the pointer Dominic - it does make me weep a bit
(`HTMLHRElement` u wot) but I'm glad someone wrote it down! (And it seems
`XMLHttpRequest` is still in violation...)

The next step is probably something more akin to PEP-8 than a partial
codification of existing norms.

On 11 July 2017 at 16:37, Domenic Denicola <[email protected]> wrote:

> https://w3ctag.github.io/design-principles/#casing-rules
>
>
>
> *From:* es-discuss [mailto:[email protected]] *On Behalf Of 
> *Alexander
> Jones
> *Sent:* Tuesday, July 11, 2017 08:07
> *To:* [email protected]
> *Subject:* Naming convention for multi-word identifiers with initialisms
>
>
>
> Occasionally this comes up when deciding on a spelling for something.
> There are numerous examples in ECMAScript and other Web standards that seem
> to defy the most uniform convention:
>
>
>
>  * `JSON` vs. `Json`
>
>  * `toJSON` vs. `toJson`
>
>  * `XMLHttpRequest` vs. `XmlHttpRequest`
>
>  * `DOMElement` vs. `DomElement`
>
>
>
> While it looks initially strange to specifically drop the capital letters
> on an initialisms like XML, the rule is simple in that it has an obvious
> machine decoding - a capital letter starts a new word. Thus, translations
> of identifiers to other case conventions are automatic (so long as numbers
> never appear at the start of a word). This helps a lot when e.g. generating
> bindings for IDLs to different languages, or in general interfacing
> different systems that really, really want to use their own naming
> conventions.
>
>
>
>  * mixed case: `myTlaIdentifierHere`
>
>  * pascal case: `MyTlaIdentifierHere`
>
>  * underscore case: `my_tla_identifier_here`
>
>  * uppercase: `MY_TLA_IDENTIFIER_HERE`
>
>  * kebab case: `my-tla-identifier-here`
>
>  * spaces case: `my tla identifier here`
>
>
>
> ---
>
>
>
> My question is whether there is an existing community recommendation
> anywhere for naming ECMAScript identifiers. Clearly, when Microsoft devised
> the name `XMLHttpRequest`, someone was having a difficult time figuring out
> how to spell adjacent initialisms in PascalCase.
>
>
>
> If there is no recommendation, perhaps there should be? Is there any scope
> for non-normative sections of information like this in the ECMAScript spec?
>
>
>
> Thanks
>
>
>
> Alex
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to