Just realizing that spread + default params make it easy to guarantee same object map due to locking order of property assignments.
function foo({ a, b = null, c }) {}
// both end up with opts of same Map
foo({ a: 1, c: 2})
foo({ c: 2, b: 1, a: 3 })
Correct? @bmeurer @mathias
No, the objects still have a different shape. @v8js desugars the destructuring into (simplified):
tmp = obj;
a = tmp.a;
b = tmp.b;
c = tmp.c;
You can see this by using --print-ast.
The loads still happen on the object that gets passed in, and so you go polymorphic anyway.
4:06 PM - 27 Apr 2018
0 replies
0 retweets
3 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.