[Haskell-cafe] Compiler's bane

Andrew Coppin andrewcoppin at btinternet.com
Sun Aug 31 15:14:14 EDT 2008


Ryan Ingram wrote:
> What are you trying to get from the "let" binding?  Sharing?
>   

Convinience.

  let x = foo in bar

is so much easier to write than

  (\x -> bar) foo

when foo and/or bar is large.

Trouble is, as soon as you allow let-bindings, some clever person is 
going to start writing recursive ones. And actually, that's a useful 
thing to be able to do, but it makes figuring out the technical 
details... rather nontrivial. (Seriously, I had no idea I was going to 
get into this much trouble!)
> The usual idea is that "let" represents heap allocation, and you
> evaluate the leftmost-outermost redex as usual, doing let substitution
> only when necessary to continue evaluation, and garbage-collecting
> bindings that no longer refer to variables in the current computation

Right. So ignore the let-bindings unless the redex of interest is a 
let-bound variable? That sounds reasonably easy...



More information about the Haskell-Cafe mailing list