@boomzilla said in I think I know what makes a truly competent programmer:
The ECMAScript/JavaScript language itself, however, exposes characters according to UCS-2, not UTF-16
The ECMAScript language does no such thing.
The only mention of UCS-2 in the spec is here:
A conforming implementation of this Standard shall interpret characters in conformance with the Unicode Standard, Version 3.0 or later and ISO/IEC 10646-1 with either UCS-2 or UTF-16 as the adopted encoding form, implementation level 3. If the adopted ISO/IEC 10646-1 subset is not otherwise specified, it is presumed to be the BMP subset, collection 300. If the adopted encoding form is not otherwise specified, it presumed to be the UTF-16 encoding form.
For characters inside the BMP - that is, all valid Unicode code points representable as single unsigned 16-bit ints - UCS-2 and UTF-16 encodings are identical. Every syntactical element of an ECMAScript program other than string literals is composed of just such characters, so the only way to decide whether UCS-2 or UTF-16 is "the" coding actually used by ECMAScript is to examine the rules for handling strings.
Turns out that an ECMAScript string value is a just a sequence of uint16 with no restriction at all on contents:
4.3.16 String value
primitive value that is a finite ordered sequence of zero or more 16-bit unsigned integer
NOTE A String value is a member of the String type. Each integer value in the sequence usually represents a single 16-bit unit of UTF-16 text. However, ECMAScript does not place any restrictions or requirements on the values except that they must be 16-bit unsigned integers.
When offering guidance as to how to interpret those values as text, the spec
does mention UTF-16 and
does not mention UCS-2.
Mathias Bynens is of course completely free to conclude that Javascript strings are "really" UCS-2 on the basis that Javascript strings used fixed-size characters that are the same size as those defined by UCS-2 and doesn't enforce the UTF-16 rules around values \uD800-\uDFFF, but he's wrong. It doesn't enforce the UCS-2 rules for those values either.