Ask HN: Typescript but for statically checking side-effects?

3 points by skdotdan ↗ HN
Hi HN. I love functional programming. While many developers had been using the static type systems for ages, the JavaScript community appears to have discovered it recently thanks to Typescript (no flame here, I'm not saying statically typed languages are better, but I do personally prefer them). I know many JavaScript developers who have had their "aha" moment with the static type systems.

Yesterday I told a friend of mine (who is a self-taught frontend developer and user of Typescript) that sooner or later something similar will happen with the side-effects. I'm not saying that languages like Elm or Purescript will become mainstream, but I think that static side-effect checkers will gradually become widely used. Maybe starting with adding the "pure" annotation to the Typescript functions [1] (Solidity already has this feature), although I believe something more complex is needed.

What do you think? How would you implement this behaviour in a language targeted at JavaScript developers (transpiled to JavaScript)? I use Purescript myself but I don't think purely functional languages will ever be mainstream. Instead, traditional languages will be getting more and more functional-like features.

[1] Suggestion: document and enforce side effects of functions https://github.com/Microsoft/TypeScript/issues/19520

0 comments

[ 3.0 ms ] story [ 10.5 ms ] thread

No comments yet.