|
|
|
|
|
by swertyb
2188 days ago
|
|
> But most people are not very good at writing imperative
> code correctly, at least not the first time, and not
> without writing a large volume of tests (usually several
> times as much test code as program code) to verify that
> imperative code. How are languages other than Go (like Rust, Swift etc.,) not imperative? They are nearly as much imperative as Go but have FP features like ADTs and pattern matching, but those don't make them "functional". This point might be valid if you are talking about Haskell, MLs and the likes. > I much prefer being able to encode behavior and constraints
> into the types I define over writing a bunch of tests to verify that the constraints
> I've expressed in code are correct. Why do the work that a compiler can
> do for you, and do it much better and more reliably than you? IMO, this "types replacing tests" might be true when comparing dynamic vs static typing, but for already static typed languages, extra typing cannot be a substantial gain. Personally, I find type-level programming beyond a certain extent to be counter productive and it doesn't seem to have much impact on correctness (unless we bring in dependent types). |
|
I just fundamentally disagree that "extra typing" (as you put it) doesn't give you much of a gain in correctness confidence.