Proposal: Static Typing

Bergi a.d.bergi at web.de
Mon Mar 25 10:19:24 UTC 2019


Hi,

> I am having hard time understanding the counter argument "you need a
> transpiler anyway".

Sorry, I agree it's a bad argument, I should have just omitted it.
It was meant to support "If you are only looking for development-time
benefits, you have to install a static toolchain anyway - which might as
well transpile away the annotations".

>> the real value of strict types, in my view, is at development time,
> not at run time.
>
> This is not correct. Check what AssemblyScript managed to do via types,
> targeting WASM instead of non-typed JS
>
>> I would be curious to know if anybody has a usage for them at run time
>
> Developers might not have such usage, but V8 / Chakra / JSC /
> SpiderMonkey might spin up optimizations ahead of time, enabling right
> away hot code.

...or at least allow throwing exceptions instead of having to
de-optimise a JITted code, which allows simpler & better optimisation
algorithms.

These are the kinds of arguments I want to hear, reasons for sending
type annotations to the client/runtime. And such a goal puts a very
different focus on what the type system should look like: WASM
interoperability and optimiser efficiency instead of developer productivity.

kind regards,
  Bergi


More information about the es-discuss mailing list