Not much, as far as I can tell. Engines do usually lower this, and redo the whole object when the shape changes, or an intrinsic no longer applies. V8 has a MathPow intrinsic, and I believe SpiderMonkey has similar.
On Wed, Aug 26, 2015, 23:45 Jordan Harband <ljh...@gmail.com> wrote: > Is there also perhaps a potential performance/static analysis benefit in > having it be syntax, rather than a builtin function? `Math.pow` can be > overwritten, and varies per-realm, but `**` can not and does not. > > On Wed, Aug 26, 2015 at 8:21 PM, Mark S. Miller <erig...@google.com> > wrote: > >> >> >> On Wed, Aug 26, 2015 at 6:19 PM, Waldemar Horwat <walde...@google.com> >> wrote: >> >>> On 08/26/2015 15:08, Mark S. Miller wrote: >>> >>>> The force of that precedent is indeed what my objection is. The "yield" >>>> counter-example is interesting, but "yield" is an identifier not an >>>> operator symbol, and so does not as clearly fall within or shape operator >>>> expectations. >>>> >>>> If someone explains a compelling need for ** I would find that >>>> interesting. But until then... >>>> >>> >>> ** is a convenience, and that's the wrong criterion to apply here. If >>> it were, then we wouldn't have useful conveniences like Math.cosh or arrow >>> functions. >>> >>> I'd rather read >>> >>> a*x**3 + b*x**2 + c*x + d >>> >>> than >>> >>> a*Math.pow(x, 3) + b*Math.pow(x, 2) + c*x + d >> >> >> >> >> >> Ok, we have a benefit to evaluate. Brevity. With the example contrast >> between >> >> a*x**3 + b*x**2 + c*x + d >> >> and >> >> a*Math.pow(x, 3) + b*Math.pow(x, 2) + c*x + d >> >> Let's also apply Alexander's suggestion >> >> a*x.pow(3) + b*x.pow(2) + c*x + d >> >> To help us compare for brevity, and because I'm too lazy to count, I'm >> sending it in a fixed width font. >> >> >> -- >> Cheers, >> --MarkM >> >> _______________________________________________ >> es-discuss mailing list >> es-discuss@mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> >> > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss