5 ms·
"Haskell enables code reuse by not allowing side effects" As an onlooker, I wonder: is reuse in Haskell fundamentally better than reuse in another language whe
by ced 19y ago
"Haskell enables code reuse by not allowing side effects"
As an onlooker, I wonder: is reuse in Haskell fundamentally better than reuse in another language where the programmer avoids (or clusters) side-effects?
- jaggederest 19y agoWell, if you avoid side effects assiduously enough, other languages can certainly have that sort of purity. However, you have to remember, avoiding side effects is what enables lazy evaluation, which is a huge gain in terms of performance. If you're not restricting side effects, you can't default to lazy evaluation.
- ced 19y agoTrue... And not having lazy evaluation encourages one to write Matrix.CalculateDeterminant() rather than Matrix.determinant, as it should be. But I don't think that has to do with reuse.
- jaggederest 19y agoRight, I'm saying, code reuse via no side effects is a nice part of the package deal