From: dblack@... Date: 2002-10-30T01:11:43+09:00 Subject: Re: method-call style (was Re: Snippet: Tiny Featureless Ruby Web Server) Hi -- On Wed, 30 Oct 2002, Paul Brannan wrote: > On Tue, Oct 29, 2002 at 11:38:57PM +0900, 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. > > I do the same thing. It makes it clear that I'm calling a method and > not retrieving an attribute. I suppose it comes from my C++ background: > > class Foo > { > void foo() > int bar; > }; > > Foo f; > f.foo(); > int x = f.bar; But since attributes are retrieved by method calls in Ruby, that distinction doesn't hold. Or, to put it another way, since all cases of obj.message in Ruby are the foo() case, the () doesn't actually add any information or tell us anything. I guess that's why it leapt off the screen at me a bit. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav