TT strings: implementation questions

Jim Blandy jimb at mozilla.com
Wed Jun 11 07:54:20 PDT 2008


"Michael Daumling" <mdaeumli at adobe.com> writes:
> 1) I am seeing this comment in StringObject.h:
>
> // unfortunately, memcmp isn't guaranteed to return the actual
> difference between the final bytes (as required
> // by localeCompare), only -1/0/1, and the MSVC implementation seems to
> do the latter.... Sigh
>
> Why does localeCompare() have this requirement? ECMA-262 does not
> mention it.

In the case of JavaScript, I get the impression that the general
practice is to go well beyond what the spec requires to remain
compatible with existing implementations' behavior.  My thinking is, a
new C compiler can choose a novel but compliant interpretation of the C
standard, and it's (mostly) okay because the first people to encounter
resultant changes in behavior are developers, who can do something about
it.  But JavaScript on the web will often be executed first with a new
browser by an end user.

So it seems to me the spec is useful for recognizing violations, but
compliance with the spec isn't a guarantee of good behavior.  It only
works one way.


More information about the Tamarin-devel mailing list