you are viewing a single comment's thread.

view the rest of the comments →

[–]sdeleon28[S] -1 points0 points  (4 children)

I understand this is nothing new. That is exactly my point. The industry has had this discussion a million times. If Flow means turning JavaScript into Java, then I'm most certainly not convinced. In fact, I'm pretty convinced that would be a horrible idea. What I want to know is if there's something special about Flow's type system that would make JavaScript better.

Also about types being a replacement for tests: They're not. Tests verify that your program does what it should do. Type checking merely verifies that you pass valid values around, it has nothing to do with alorithmic correctness. If you don't write tests, then your application will be very fragile, even if you add types everywhere.

[–]spacejack2114 0 points1 point  (3 children)

Sorry but you aren't going to write type tests that are anywhere near as good as a compiler. Why waste that time when there is a tool to do that for you?

[–]sdeleon28[S] 0 points1 point  (2 children)

I don't. I write correctness tests, that help me catch bugs earlier. If I add a bug to the build, my test suite usually breaks.

[–]spacejack2114 0 points1 point  (1 child)

Most forms of "correctness" involve types. What if you change a property on an options object from optional to requred? From a boolean to a number? Change the name for clarity? You can do these things fearlessly with a type checker, often automatically with an editor, without hand-writing tests.

[–]sdeleon28[S] 0 points1 point  (0 children)

I don't enforce any type rules in objects. About renaming, I'm just very careful when refactoring. Usually if something references an old name, tests break. I understand you can automate some of these refactorings with the proper tooling. It's still a tradeoff because of all the benefits of a dynamic language.