From: Robert Dober Date: 2006-10-08T21:10:47+09:00 Subject: Re: nil being empty ------=_Part_148341_20853261.1160309444556 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 10/8/06, Marc Heiler wrote: > > "[...] neither Ola Bini nor Martin Fowler consider it necessarily bad > form, depending on your context, i.e. whether it adds to or detracts > from the maintainability of your code." > > Surprisingly, with few exceptions, I found that in Ruby its > usually better to go very straight at a problem, and better short > than long... helped me to maintain my own code nicely. > > That also means, for me though, that I do agree it is a bit awkward > to ask whether the spoon is full or empty, when there really is > no spoon. :-) > > "Then by simple logic, the right solution will be to have it > return false" > > I dont think you can apply a lot of logic > on nil at all. Maybe not even a simple logic. ;-) Hmm Tom and you have brought up the *real* question, who really is this ni= l buddy? Modelling it correctly seems almost impossible, maybe you might want to not= e my "Void" proposals above ( I actually like that pun ;). But I was quite convinced that from a less philosophical point of view, defining NilClass#empty? should ring alarm bells in your head about the design, which does not mean it is bad, you know once I calculated the first digit of Pi, still no one calculated the last, although I have asked *politely* ;) and it turned out to be 2, so that was not a proof that my calculation was bad, but I checked them out nevertheless, and of course it was correct anyway. Hopefully that extreme example takes my point across, it would be most interesting to have a look at the code where your NilClass#empty? was necessary. Cheers Robert -- > Posted via http://www.ruby-forum.com/. > > --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_148341_20853261.1160309444556--