Hacker News new | ask | show | jobs
by the8472 4035 days ago
> And maybe makes static analysis easier.

> But still not sure if it was really needed.

That depends on your definition of "needed" of course. Do we need any abstractions? Why not just write assembly, nay, machine code?

Static analysis enables a lot of tooling (accurate auto-completion, compile-time type checking, null-analysis, ) and can also make life easier for the JIT compilers[1].

On the one end of the spectrum it's not needed because as long as a language is turing-complete it can do anything any other turing-complete language can do. On the other end it is needed to make your life easier and be more productive by offloading work from your brain to the CPU.

[1] https://developers.google.com/v8/experiments

1 comments

I'd argue this abstraction isn't any higher-level than the function equivalent above. More readable, maybe.
explicit annotations following a specific syntax can be analyzed by a checker.

you can't really do that (easily) with ad-hoc typecheck wrappers.