5 ms·
Now you're not even listening to what I said. In my topmost post in this thread I showed how pure code in Haskell is susceptible to dramatically fewer potentia
by mightybyte 12y ago
Now you're not even listening to what I said. In my topmost post in this thread I showed how pure code in Haskell is susceptible to dramatically fewer potential bugs than equivalent code in any other mainstream language.
I said:
> There are no other possibilities, period.
And you agreed:
> That's true!
Most of that bug reduction was made possible by Haskell's purity/immutability. Now you're completely ignoring that point that we already established.
> In Haskell, it may be easier to find where the IO code is, using the type system, but that doesn't make any of the code correct.
No, it doesn't deductively "make any of the code more correct". It makes the code inductively "more likely to be correct". You asked for empirical evidence for the inductive claim and I gave it to you.
> You could do that in any language.
No, you could not. Other languages have module systems with hiding, but they do not have purity, the ability to categorically eliminate things like null errors, etc. You're zooming in to one feature, but it's not just one feature that enables all this. It's the combination of several.
- infraruby 12y ago> And you agreed: I did agree that you can prove some properties about your code. Specifically, you can prove which parts of the code do not perform IO, and in that limited sense "if it compiles, it works" for that example, but that does not hold in general. I did not agree that your code is more likely to be correct in general. The non-IO code may still be wrong (as you said then: it could return the first element of the list instead of the last one) and the IO code may also be wrong. And you have no evidence that any of that code is more likely to be correct. The Haskell compiler can enforce some organization on your code (IO code goes here, non-IO code goes there) but the bugs could still be anywhere. All you have done is to shift the deckchairs on the Titanic! > Most of that bug reduction was made possible by Haskell's purity/immutability. You have no evidence of any actual bug reduction. > You asked for empirical evidence for the inductive claim and I gave it to you. Working deductively from the definition of Haskell is not empirical evidence for the claim that Haskell programs are more likely to be correct.
- mightybyte 12y ago> And you have no evidence that any of that code is more likely to be correct. > You have no evidence of any actual bug reduction. > Working deductively from the definition of Haskell is not empirical evidence for the claim that Haskell programs are more likely to be correct. My deductive reasoning is not the evidence I'm citing here. We counted the total number of ways that a function could go wrong and saw that in pure Haskell code, the number is drastically reduced. We know that the bug types we eliminated actually occur in practice, so under the reasonable assumption that the distribution of bug types is relatively constant, those numbers do provide empirical evidence (observational, not experimental) that Haskell programs are more likely to be correct. Yes, pure code can still be wrong, but it can be wrong in a lot less ways than the impure code that you're stuck with in other languages. That code is still doing useful work that is also bug-prone in other languages. Therefore we can be reasonably confident that it will reduce bugs. If you absolutely insist on experimental evidence, we have that too: https://www.youtube.com/watch?v=BveDrw9CwEg#t=1207 https://www.youtube.com/watch?v=BveDrw9CwEg#t=1207
- infraruby 12y ago> My deductive reasoning is not the evidence I'm citing here. You have no evidence, only (invalid) deductions. > We counted the total number of ways that a function could go wrong If you did this it would be deduction. > and saw that in pure Haskell code, the number is drastically reduced. No. Say you have an IO function with two parts, a non-IO part to compute a directory name using some input, and an IO part to remove that directory: rmrf_steamroot some_input = -- some code to compute a directory name using some_input ... -- some code to remove that directory ... Now, the first part does not perform IO, so let's extract that into a non-IO function: compute_directory_name some_input = -- some code to compute a directory name using some_input ... rmrf_steamroot some_input = let directory_name = compute_directory_name some_input -- some code to remove that directory ... How many bugs were removed by doing this? None. It's the same code, just moved about a bit. Sure, the code in the non-IO function "compute_directory_name" does not perform IO (and therefore does not have IO bugs) but that code did not perform IO (and therefore did not have IO bugs) when it was in the original IO function "rmrf_steamroot"! So there is no bug reduction. > those numbers do provide empirical evidence (observational, not experimental) That is not empirical evidence. Perhaps it may help you to read this introduction to the topic: https://en.wikipedia.org/wiki/Empirical_evidence (And where it says "observation or experimentation" it may help if you follow those links.) > If you absolutely insist on experimental evidence, we have that too As you said earlier, they "rewrote a substantial groovy app in Haskell". There are too many confounding variables there.