From: John Carter Date: 2005-05-06T12:43:35+09:00 Subject: Re: RCR 303: nil should accept missing methods and return nil On Fri, 6 May 2005, Luke Graham wrote: > On 5/6/05, John Carter wrote: >> I expect if this is accepted to see a bunch of knock on RCR's, namely >> nil+n == n >> nil * 7 == 0 >> -nil == 0 >> >> We already have >> nil.to_s == "" >> nil.to_i == 0 >> nil.to_f == 0.0 > > This would be a big change to behaviour and a lot of existing programs > could have problems with it. Because integers already have a to_i(), > its possible to do this... If there were a lot of programs deliberately doing begin # some complex calculation rescue NoMethodError => details # Do some valid functionality, not just error handling end I would agree with out. If they are not doing that, then the program would just crash totally. My change would change the behaviour from crashing, to Doing The Right thing. But I don't believe that there are programs rescuing NoMethodErrors/ I bet you could search they whole RAA and find very very little that has rescue NoMethodError. John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand This rock is covered by a very very thin scum of life. (Think 6000km of rock followed by a meter or so of biomass.) Amongst the millions of species in that scum are many hundreds of thousands of types beetle and a mere handful of primates.