From: Cyent Date: 2005-05-08T16:04:29+09:00 Subject: No Thing Here vs Uninitialized and RCR 303 I'm observing a general trend in the responses to RCR 303. The first and most striking is -w. I always, utterly and without fail, use -w and had assumed incorrectly that everyone else did. (But then I always use -W -Wall on gcc as well) This fact I find curious given the storm of but "RCR 303 might mask a bug" responses. Now let us consider when a nil does arise in ruby.... Nil arises in several places that I can think of. The most obvious case, and the case I think most people are concerned about, is when referencing an uninitialized variable. This case is flagged by -w, and hence I had mentally disregarded the possibility when I wrote RCR 303. The next case is when nil is returned by something like a regex match or an index out of bounds. The third case is when explicit set by the programmer, typically as a default parameter to a method. The fourth case is to get around the lexical scoping umfeature of rubies local variables. def foo my_var = nil box.each do |e| my_var = e if e.blah end use_var( my_var) end This is another case of "nil means uninitialized". So what we have is a "nil" is a little too busy, means too much, is overloaded too heavily. It means "uninitialized". It also means "no thing here" (as in return from regexp match (no MatchData here), index out of bounds (no Array element here), and nil as a default value.) I perfectly agree that "uninitialized" should throw a NoMethodError. Indeed I doubt if it should respond to some of the methods it does respond to currently. I even think -w is too friendly, I would prefer it to throw than to just warn. What I as thinking of by RCR 303 is nil as "no thing here" should respond to all methods, do nothing and return "no thing here". So perhaps I should retract RCR 303 and created a new one suggesting and differentiation between "uninitialized" and "no thing here", and effectively RCR-303 for "no thing here". I would welcome suggestions as to how to craft this new RCR. -- John Carter The Cybernetic Entomologist - cyent@xtra.co.nz http://geocities.yahoo.com/cy_ent I'm becoming less and less convinced of humans as rational beings. I suspect we are merely meme collectors, and the reason meme is only kept on to help count our change.