From: Dan Doel Date: 2003-08-11T01:48:36+09:00 Subject: Re: Ruby and OOP-design (question of an old "procedural person" ;) dblack@superlink.net wrote: >Hi -- > >On Sun, 10 Aug 2003, Dan Doel wrote: > > > >>But why should ? methods be required to return solely true or false? >>Isn't it enought to require that they >>return objects that evaluate to true or false appropriately? >> >> > >Jumping in with semi-devil's-advocate point: > >One situation I can think of in which it would be handy to rely on this >would be: > > if a.nil? == b.nil? > >which of course could also be written: > > if (a.nil? && b.nil?) ||! (a.nil? || b.nil?) > >or something, but obviously version 1 is nice and concise. Then again, >it's a pretty marginal case, I guess. > > >David > > > That is a good example. Does ruby not have exclusive or? I can't remember at the moment. If it did, I think the top is the same as: unless a.nil? ^ b.nil? Which is still somewhat unclear, I agree. That's a good example, though. - Dan