I read somewhere that having a method that may return different type of values is not of a good style. I first through it was in Kent's book, but I cannot find it. Is there a book that talk about this coding style?
There is a SmallLint rules that checks for this, see the class RBReturnsBooleanAndOtherRule. As a rational it states: "Checks for methods that return a boolean value (true or false) and return some other value such as (nil or self). If the method is suppose to return a boolean, then this signifies that there is one path through the method that might return a non-boolean. If the method doesn't need to return a boolean, you should probably rewrite it to return some non-boolean value since other programmers reading your method might assume that it returns a boolean." Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch