News for hackers. Stuff that matters.
Re:Faster JavaScript Calls by brundolf on Monday February 15, 2021 @01:48PM (#26145777)
Right but I'm talking about very specific hints for one codebase

"Function X will only ever take two arguments, they will be of types Y and Z"

"This object will only ever have these properties; it will never have properties created or deleted"

"This prototype will never be modified at runtime"

Re:Faster JavaScript Calls by hajile on Monday February 15, 2021 @03:15PM (#26146764)
It still has to verify that those assertions are true in practice. Any random person at the console can call a function and pass whatever they like.

The only real way to make that work would be a new `<script type="typed-module" />` variant that implemented a subset of JS in a typed environment.

My guess is that this could happen in the future, but everyone is watching Typescript as a testing ground to find exactly what works, what doesn't, and what works, but isn't desirable.

Re:Faster JavaScript Calls by brundolf on Monday February 15, 2021 @03:18PM (#26146811)
There's already a mechanism for bailing out when optimization assumptions are violated; they could be made more eagerly but retain the ability to degrade
Re:Faster JavaScript Calls by crazypython on Tuesday February 16, 2021 @12:26PM (#26156310)
> "This object will only ever have these properties; it will never have properties created or deleted"

Already in JavaScript: Object.seal(object)

> "This prototype will never be modified at runtime"

Already in JavaScript: Object.freeze(myPrototype)