From: Robert Dober Date: 2006-10-06T21:41:39+09:00 Subject: Re: nil being empty ------=_Part_127484_29056199.1160138497204 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 10/6/06, dblack@wobblini.net wrote: > > On Fri, 6 Oct 2006, Ohad Lutzky wrote: > > > Show of hands - who thinks this is bad form? > > > > class NilClass > > def empty?; true; end > > end > > /me raises hand. I feel this being an unnecessary generalization. Probably it is very often not the best way to treat the problem, but it might as easily be the most elegant. Instead of raising your hand David, please speak out ;) Now it would be unfair to ask others for their wisdom without delivering my own (as small as it might be). If you define your small little NilClass monkeypatch above because you had nils where you expected containers, guess what I think of your code ;) If on the other hand the NilClass Emptyness is integral part of your design= , document it well and go ahead! Ruby is a Tool not a Religion. (well at least I think so ;) Cheers Robert > David > > -- > David A. Black | dblack@wobblini.net > Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] > DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] > [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com > [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org > > --=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_127484_29056199.1160138497204--