Strategies for standardizing mistakes

Mike Shaver mike.shaver at gmail.com
Wed Oct 14 18:36:10 PDT 2009


On Wed, Oct 14, 2009 at 7:40 PM, Jim Blandy <jimb at mozilla.com> wrote:
> There's one specific kind of contextual information that's being looked at
> askance here: knowledge of the expression surrounding the call that invoked
> you.  Perl lets subroutines check what sort of value their caller is
> expecting; that hasn't aged well.

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.

Mike


More information about the es-discuss mailing list