From: Matt Mongeau Date: 2013-02-21T07:40:30+09:00 Subject: Re: THE CLASS/OBJECT CHICKEN-AND-EGG PARADOX Joel Pearson wrote in post #1098100: > Matt Mongeau wrote in post #1098076: >> It's not really a paradox. Take for example >> irb(main):001:0> a = [] >> => [] >> irb(main):002:0> a << a >> => [[...]] > > irb(main):003:0> a.flatten! > ArgumentError: tried to flatten recursive array > from (irb):3:in `flatten!' > from (irb):3 > from C:/Ruby193/bin/irb:12:in `
' > > Ha! I bet whoever wrote that ( Matz, presumably? ) was shaking his head > and thinking "Well this is one error message no sane programmer will > ever see." I'd never have seen that as a possibility. For more object reference shenanigans please enjoy irb(main):005:0> h = {} => {} irb(main):006:0> h[h] = h => {{...}=>{...}} irb(main):007:0> h.to_a => [[{{...}=>{...}}, {{...}=>{...}}]] -- Posted via http://www.ruby-forum.com/.