From: mengx@... Date: 2002-01-03T00:39:16+09:00 Subject: [ruby-talk:30046] Re: A Bug or something else? > > pigeon% ruby > class Fixnum > private :to_s > end > > p "#{12}" > 12.to_s > ^D > "12" > -:6: private method `to_s' called for 12:Fixnum (NameError) > pigeon% > Looks like it only happens in string evaluation? apparently, Ruby's interpreter bypasses the rule, correct? > Well, I've not yet understood what you have against `nil' :-)) but I > suspect that you expect that it work like an `undef' (i.e. undefined > value), no ? I meant that any ruby method/C-function should check if a variable is nil and raise exception or whatever action is appropriate, such that "1 == nil" would raise an exception instead of being false. nil.to_s -> "" and nil.to_i -> 0 seem really strange. They are not even consistent with Ruby's own idiom that "" and 0 evaluate to "true" in logical context. Thanks -Ted