News for hackers. Stuff that matters.
Re:Don't use functions as callbacks unless they're designed ... by fulafel on Saturday February 06, 2021 @06:01AM (#26045751)
I don't think we can excuse it by citing the nature of source-to-source compilers. Other languages like Haxe, Elm, ReasonML, ClojureScript etc that target JS don't suffer from this.
Re:Don't use functions as callbacks unless they're designed ... by searchableguy on Saturday February 06, 2021 @06:05AM (#26045774)
Unsound type system was a sacrifice made for easy migration from javascript.
Re:Don't use functions as callbacks unless they're designed ... by Aeolun on Saturday February 06, 2021 @06:16AM (#26045803)
And wildly successful at that. At least I can use typescript with my existing codebase. Rewriting everything in haxe isn’t exactly appealing.
Re:Don't use functions as callbacks unless they're designed ... by fulafel on Saturday February 06, 2021 @06:10AM (#26045787)
That may be for the static type system but you could still check and signal an error at runtime instead of silently ignoring it.