[Haskell-cafe] Re: let and fixed point operator

Peter Hercek peter at syncad.com
Thu Aug 30 12:37:18 EDT 2007

1 f x =
2    let x = x * scale in
3    g x

Hmmm ... just assume that the scope of the x on line 3 (which
  hides the x from the higher level scope is extended from line 3 to
  the beginning part of line 2 (from line start to the equal sign).
  OCAML does it. "Let before" in Clean does it too. Does not sound
  bad to me either. So this sounds to me like weak argument compared
  to disadvantages. There should be something else (I'm missing)
  there too...


Dan Piponi wrote:
> On 8/30/07, Peter Hercek <peter at syncad.com> wrote:
>> f x =
>>    let x = x * scale in
>>    let x = x + transform in
>>    g x
> Why are you trying to call three different things by the same name 'x'
> in one tiny block of code? That's very confusing and makes it hard to
> reason equationally about the code.
> --
> Dan

More information about the Haskell-Cafe mailing list