"Cristian Baboi" <[EMAIL PROTECTED]> wrote:

> What is more strange is that a = a + 1 and a = 1 + a are somehow
> distinct. The second give a stack overflow almost instanly, but the
> first don't.
> 
That's because what the runtime does looks in the second case like
a = 1 + 1 + 1 + 1 + 1 + ... + a ...
and the first like
a = a = a = a = a = a = a = ... = 1 + a
, which is a much more space efficient endless loop.

That's not specified though, the runtime could choose to let + force
the two chunks the different way round.


-- 
(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited. 

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to