From: dblack@... Date: 2002-10-30T01:16:26+09:00 Subject: Re: method-call style (was Re: Snippet: Tiny Featureless Ruby Web Server) Hi -- On Wed, 30 Oct 2002, William Djaja Tjokroaminata wrote: > dblack@candle.superlink.net wrote: > > > I have a style-related question: I noticed that you put () after all > > method names, and I was wondering what the origin/purpose/whatever of > > that was. I'm neither trying to criticize it, nor likely to adopt > > it myself :-) Just wondering. > > Hi David, > > This is just my personal style. When I write network simulations (not > Ruby code fragments), I never put () for methods that are defined simply > using "attr_reader", but other methods I usually put () to remind > me that I am "doing some real action" here. Well, in Ruby () is really > optional for methods without arguments, so I just take this advantage to > mimic the C's member data access vs function call distinction. On the > other hand, for a method call with a single argument of type block, I > don't put () either, because the {} is enough as a reminder to me that > "some real action is going on here". Doesn't that mean that you always have to know whether something was defined with attr_reader? That seems like a kind of arbitrary thing -- it could always be redefined. Also, what if you're using a library package? David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav