Re:Clojure at Netflix (2013) [slides]
by didibus on Thursday November 01, 2018 @07:05AM
(#18352738)
ClojureScript is strongly typed. I'm curious to know the specific case they ran into? I suspect it might have been interop with JavaScript, because you shouldn't have weak types in ClojureScript.
[ Parent
| on HN ]
Re:Clojure at Netflix (2013) [slides]
by darksaints on Thursday November 01, 2018 @06:48PM
(#18359162)
No, it's not. Try `(+ 1 "1")` in clojure and clojurescript. In clojure, it produces a runtime exception. In clojurescript it silently errs, resulting in a "11".
The compiler correctly infers and warns of the problem, but that is of no use if your inputs change types on you. In the case of the service I'm referring to, an external service started serving up json strings for large numbers, whereas it had previously been json numbers. Since there was no exception produced, it silently corrupted data for a couple weeks before it was caught.
I asked about this here: https://clojureverse.org/t/clojurescript-is-weakly-typed/311...
And documented to what extent types are automatically coerced.
Also got the rational behind this: performance.
And that every new release of the compiler performs smarter and smarter type inference and can warn about more of these cases. Though it still misses some as of now.
People were running a real money service that consumed JSON from another service and it didn't validate the incoming JSON? Wow.
Re:Clojure at Netflix (2013) [slides]
by saosebastiao on Friday November 02, 2018 @06:55PM
(#18367396)
The problem comes from the fact that clojure and clojurescript are two different type disciplines, but people approach them with the same expectations. That exact problem would have errored out if they were running clojure, and a thrown exception is good enough validation for many developers. But because they were duped into a false safety net by thinking clojure == clojurescript, it slipped right underneath their radar.