News for hackers. Stuff that matters.
Re:Code is Engineering; Types are Science by slifin on Monday April 06, 2020 @06:30AM (#22792388)
If I was given the choice, I can have either static analysis or types I would pick static analysis every time
Re:Code is Engineering; Types are Science by nicoburns on Monday April 06, 2020 @06:32AM (#22792401)
Types are just one kind of static analysis. So it makes sense that you'd want the superset rather than the subset.
Re:Code is Engineering; Types are Science by naasking on Monday April 06, 2020 @09:19AM (#22793446)
It's not so clear cut. Types are compositional, by definition.

Static analysis needn't be compositional, and so a small change could cause dramatic and unpredictable long-range effects elsewhere in your code. Figuring out what changed or what went wrong can be a nightmare.

Re:Code is Engineering; Types are Science by diegoperini on Monday April 06, 2020 @10:34AM (#22794059)
I had the chance to experiment this idea a few years ago. I had a text editor which could only lint Javascript. My project was a haskell+js hybrid. There was no analysis for hs aside from running the compiler and seeing the output.

Writing the hs part was a nightmare at first. Once the project grew and I needed refactoring, js became the main nightmare. Hs simply did its thing which at that point, I already had got used to it. Js couldn't tell me if anything wrong outside of function boundaries.

A smarter js linter may prove me wrong but I believe types serve a long term goal by sacrificing productivity in the beginning.

Re:Code is Engineering; Types are Science by OJFord on Monday April 06, 2020 @11:21AM (#22794506)
I don't understand this dichotomy - type checking vs. all other static analysis? Or unchecked types vs. static analysis without types? Or something else?