>>>>> "m" ==   <mengx / nielsenmedia.com> writes:

m> Thanks. I guess this is a special case when nil is used in something like string
m> substitution. Below are some examples:

 No, this is not a special case for nil

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% 

m> That is exactly what I meant. It is impossible to achieve what a static
m> typed language can do for this purpose, but for "nil", it would not be too
m> hard to conduct a check for "nil", a special and straitforward case in
m> either C interpreter or Ruby itself. Does it sound reasonable? I am a little
m> obsessed with this since it is a great danger to silently corrupt data due to
m> common program errors. 

 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 ?


Guy Decoux