From: dblack@... Date: 2003-08-11T02:02:33+09:00 Subject: Re: Ruby and OOP-design (question of an old "procedural person" ;) Hi -- On Mon, 11 Aug 2003, Dan Doel wrote: > dblack@superlink.net wrote: > > >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. I, however, no long agree with myself :-) I just forgot about ^. > That's a good example, though. Hmmm... I wonder if it could be strengthened by finding a case where there actually isn't an equally short (or shorter) alternative. I can't think of one. Of course, as I mentioned, I've sort of playing devil's advocate -- I don't think the non-true-or-false return value actually bothers me. David -- David Alan Black home: dblack@superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav