Skip to content

Comment on Show HN: ES7 Decorator library adds types checking, memoization, and more to JSparent

Comments

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

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.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.