5 ms·
The comments on the blog post are hilarious to me. "And why do you need type safety? Because you are used to?" Er. Well, if you like driving a car with no sea
by mjt0229 11y ago
The comments on the blog post are hilarious to me.
"And why do you need type safety? Because you are used to?"
Er. Well, if you like driving a car with no seatbelts, crumple zone, or airbags, I guess that's fine with me. But when I get in a car, I buckle up.
- kod 11y agoThat's a somewhat poor analogy, since airbags etc don't prevent you from doing certain driving maneuvers. Static type systems prevent you from expressing certain programs (I think this is a good thing, but not everyone does). A better analogy would be antilock brakes or understeer - safer but prevents you from doing certain things.
- mjt0229 11y agoAgreed.
- to3m 11y agoA better analogy would be driving a car - it's not a tangerine.
- ch 11y agoMore like it allows you to accelerate with a pedal on the floor rather than by pulling a string attached directly to the throttle. No loss of flexibility, but you put some trust in the vehicle that you would otherwise have to manage yourself.
- ybx 11y agoA better analogy is the one that's twisted to fit my narrative. (both you and the parent comment are kinda doing this)
- sgeisenh 11y agoOnce you've experienced the joys of parametricity, you can never go back!
- rlander 11y agoYup, came here to say that! The "If you don't like JavaScript, just use CoffeeScript like everyone else! What's wrong with you?" reaction made me laugh.
- junke 11y agoThe static types protect you from undesired runtime behaviors with respect to OCaml's runtime semantics, but what about Javascript's one? This is better than nothing, sure, because your code is first checked in OCaml but once the code is running, it does it according to Javascript rules. I imagine there could be subtle bugs introduced during this process (e.g. your OCaml code manipulate integers, but Javascript has numbers, a.k.a. double floats, as far as I know).
- Drup 11y agoThis is no different than trusting the processor for running the emmited assembly according to the model you have for what assembly is supposed to do. Here, the compiler emits (a subset of) javascript which are assumed to have a semantics, and we trust the browser engine to execute it according to the semantic. Of course we don't assume the semantic of javascript to be sane, we just assume it follows the spec (and we emit accordingly).
- rlander 11y agoI see your point, but that's like arguing compiled Haskell code is unsafe, since Haskell has type erasure. Any code generation machinery is subject to subtle bugs and especially so the flesh and bones kind ;)
- e_d_g_a_r 11y agoI haven't had a single problem at all and I've wrapped even the most sensitive stuff like the event emitter itself and streams.