Strategies for standardizing mistakes
jimb at mozilla.com
Thu Oct 15 09:54:17 PDT 2009
On 10/14/2009 06:36 PM, Mike Shaver wrote:
> Our implementation of String.prototype.match checks the context in
> which it's called, to see if it need bother with the expense of
> constructing the result array (it needn't, if the match call is being
> used simply as a test, which isn't unheard of on the web). That
> optimization aged pretty well, and indeed benchmarks often encourage
> such context-sensitivity.
It aged well because it obeys the fundamental principle of optimization:
"Lying is fine as long as you don't get caught." You haven't changed
the meaning of the language. document.all is in a different category,
because it's observable.
More information about the es-discuss