From: "David A. Black" Date: 2009-02-17T11:59:59+09:00 Subject: Re: What are your favorite Ruby features? Hi -- On Tue, 17 Feb 2009, Tony Arcieri wrote: > On Mon, Feb 16, 2009 at 3:25 AM, David A. Black wrote: > >> or open classes and monkeypatching (I don't know which >> of the various meanings of the latter you mean; I think they're all >> subsets of the former) > > > Pretty much, that was meant to cover all cases of altering the definitions > of existing classes/modules at runtime by a facility which may lack formal > knowledge of what the original definition actually was. I would say that altering core functionality badly is not a favorite thing, but doing it knowledgeably might be :-) >> or optional parens and English-like readability >> (I'm ambivalent about both, but for different reasons, and it depends >> a bit which optional parens you mean). >> > > This is another case of overlap... the "English-like readability" bit > typically plays into DSLs which use English words and generally try to make > your code read more like a natural language (e.g. RSpec) > > I certainly understand that people can like optional parens for other > reasons but DSLs are one particularly compelling use case for them, I > believe. I know people sometimes bundle the concept of DSL and the idea of sounding like English together (with mixed success, usually, in my view), but "domain-specific" doesn't really imply emulation of natural language; it just implies a particular well-defined emergent notation based on a subset of (computer) language constructs. At least, that's how I see it. I guess the only form of optional parentheses I actually would prefer Ruby not to support is: def a b, c = 1 but it's not a very big deal. >> A couple of other things that might go on such a list: >> >> String interpolation > > > This was covered by the poll, I believe, although described as: > > Embedding code in strings with "#{mycode}" Whoops, I forgot that when I made my list. > >> Zero being true > > > Yes, definitely a noticeable omission. I love Ruby's boolean semantics > although they seem to confuse newbies to the language. It's definitely one of the Ruby rites of passage :-) David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) Ruby Training Atlanta! April 1-3, http://www.entp.com/training/atlanta09