From: Eric Hodel Date: 2005-11-08T04:40:40+09:00 Subject: Only one level? (Was: Re: why?) On Nov 7, 2005, at 7:10 AM, Dirk Meijer wrote: > hi all, > def foo(string) > arr=[string] > puts arr > arr.each do |b| > foo(b) > end > end > foo("foobar") > this results in an endless loop.. (though it gives SystemStackError) > but why doesn't this go any deeper than one level? Ruby 1.8.3 omits the duplicate frames: $ ruby def x() x end x -:1:in `x': stack level too deep (SystemStackError) from -:1:in `x' from -:2 $ ruby -v ruby 1.8.3 (2005-09-21) [powerpc-darwin8.2.0] 1.8.2 and earlier do not: $ ruby182-orig def x() x end x -:1:in `x': stack level too deep (SystemStackError) from -:1:in `x' from -:1:in `x' from -:1:in `x' from -:1:in `x' from -:1:in `x' from -:1:in `x' from -:1:in `x' from -:1:in `x' ... 1105 levels... from -:1:in `x' from -:1:in `x' from -:1:in `x' from -:2 $ ruby182-orig -v ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0] -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04