4 ms·
This reminds me of the Haskell language, which goes to great lengths to be "lazy", meaning it tries to avoid doing computations until the last moment. Sometime
by giovannibonetti 5y ago
This reminds me of the Haskell language, which goes to great lengths to be "lazy", meaning it tries to avoid doing computations until the last moment.
Sometimes it is convenient (e.g. to work with infinite/very large lists), but I've heard that oftentimes it makes the performance very unpredictable, as a CPU spike arrives all of a sudden in the last moment.
Anyway, take this with a grain of salt, as I'm still beginning my journey with the language.
- jonny383 5y agoStill beginning and already shilling the language. What is it about Haskell that induces this fanboyism?
- dundarious 5y agoI didn't even read GP's comment as an endorsement. Mere mention of a language, one of its occasional conveniences, and its potential serious downsides, does not constitute shilling or "fanboyism".
- whateveracct 5y agoHaskell if anything has as many or more vigorous anti-fanboys that viscerally dislike it.
- Volundr 5y agoThis doesn't read as anything close to "shilling" to me. It compares lazy evaluation to copy on write, then brings up a drawback of lazy evaluation with absolutely no claim that the benefits outweigh the downsides. It certainly does not appear to be pushing anyone else to use the language.
- chriswarbo 5y ago> I've heard that oftentimes it makes the performance very unpredictable, as a CPU spike arrives all of a sudden in the last moment. In a sense, all of the computation occurs in the "last moment", since that's when we're 'forced' to make a decision (more precisely, computation occurs when (a) it's needed by the value defined as `main`; and (b) a computation is 'needed' when we've hit a branch point that depends on its result). Even more confusing, once a computation has been 'forced', it runs backwards: it's the result which gets forced, in order to choose a branch; if the definition of that result involves branching, that will force other values so we can figure out which branch to take; if those involve branching then more values may get forced; and so on until we reach some branchless 'input'.