From: Michal Suchanek Date: 2009-02-18T22:27:17+09:00 Subject: Re: What are your favorite Ruby features? 2009/2/18 Robert Dober : > On Wed, Feb 18, 2009 at 9:48 AM, Florian Gilcher wrote: >> >> On Feb 17, 2009, at 9:30 PM, James Britt wrote: >> >>> David Masover wrote: >>> Same here. I think of them as FGPs: Feel-good parentheses, used because >>> they make people accustomed to C or Java feel more comfortable, though they >>> do not contribute any real code value. >> >> >> Thats a harsh statement for those that do actually like parantheses and not >> because they are C//Java-Guys. > I did not think so, unless you feel inferior because you are a C / > Java guy, which IMHO you should not. >> >> For example, i find the following irritating and bad style: >> >> === >> def initialize foo, bar, batz = {}, &block >> #(vs.) >> def initialize( foo, bar, batz = {}, &block ) >> === > > I find the second irritating because those parens are sooo superfluous. > Does that mean that the first idiom is bad style??? Certainly not, I > can get used to it if I must. yes, for a def the parentheses are superfluous. However, for a method call with more than one argument they often add quite a bit readability, at least for me. I also often write things like foo(bar baz) foo(bak, (bar baz)) I really wish it was possible to write foo (bar baz) but it issues a warning in ruby. What I like about Ruby is that many things are easy to start and change, and once written they are still short enough to grasp. The features that make your programs short are 1) useful utility functions in the stdlib and the possibility to monkey-patch in things that you do repeatedly 2) useful return values of many methods Together they allow chaining of methods that makes a single line of code do several things in a readable way. On the other hand there are places where you hit limits. Methods like gsub! that can return nil instead of the value on which it operates. Webrick is a nice simple web server included in stdlib. It's easy to start with. It has authentication and index generation but last time I asked around it seemed impossible to merge the two without rewriting substantial part of webrick. Thanks Michal