From: Henrik Schmidt Date: 2006-09-21T01:20:08+09:00 Subject: Re: the point of omitting parentheses ara.t.howard@noaa.gov wrote: > On Wed, 20 Sep 2006, Henrik Schmidt wrote: > >> Hi there, >> >> I'm fairly new to Ruby, so bear with me. Anyway, on with the question. >> >> What is the benefit of being able to omit parentheses on a method >> call? IMHO, parentheses improves readability; I can instantly discern, >> whether something is a method call or a variable. It would seem to me, >> that readability is, at least, part of the reason for the @-prefix on >> instance variables, thus making it difficult for a human reader to >> confuse them with local variables. Why not force a similar convention >> on method calls, namely explicit parentheses? >> >> In addition, this feature allows you to do stuff like this: >> >> def foo >> 42 >> end >> >> foo # -> 42 >> foo = 1 if false >> foo # -> nil >> >> I generally like the language but dead code with side effects makes me >> nervous. >> >> Could anyone explain to me, why it's a good idea to have the option of >> omitting parentheses on a method call? > > exit > raise > fail > fork > gets > map{|no_paren| no_paren} > string.to_i > class.new > alias_method > public > private > protected > > etc. > > > -a Wow, public, private and protected are actually method call. I wonder how they implemented that. Now I HAVE to get the source code. :) Best Regards, Henrik Schmidt