From: Dossy Date: 2002-07-07T23:02:31+09:00 Subject: Re: Pre-RCR... nil.empty? On 2002.07.07, Dave Thomas wrote: > David Alan Black writes: > > > But you could also argue that there's an element of chance or > > coincidence here. Going back to your original problem, it's true that > > cgi.params["param"][0] could be either nil or "", and that both of > > those are unacceptable. But nil and "" crop up, in this context, for > > different reasons: nil indicates no param named "param", while "" > > indicates an existent but zero-length value. > > Of course, in a pure sense you're right. > > But if you ever wrote a decent sized web application in Ruby, you > might change your mind :) Again, a reason why I think CGI#params should return a Param that inherits from Array rather than simply return an Array of String and NilClass objects ... ;-) Then you could happily define Param#empty? to Do The Right Thing for you. -- Dossy -- Dossy Shiobara mail: dossy@panoptic.com Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)