From: Hugh Sasse Date: 2005-10-29T02:04:13+09:00 Subject: Re: "Readability" inflation On Sat, 29 Oct 2005, David A. Black wrote: > Hi -- > > [...] But really I'm just puzzling things through. > > Over the years and, I think, particularly in recent months, there's > been a ton of suggestions for changing Ruby syntax. The majority > involve adding new semantics through new punctuation. Most of the [...] > Ruby has always "sold itself" to programmers in large part because it > looks so good and, in the eyes of many, many people, successfully > balances expressiveness with clarity. "Readability" is not an > absolute -- but the empirical evidence suggests that a lot of people > experience Ruby as very readable. Agreed. > > I'm certainly convinced that if even a few of the punctuation and/or > condensation things happen to the syntax, Ruby's reputation for > readability will decline rapidly and permanently. I may be wrong, but > my belief and working hypothesis is that the "readability margin" is > quite narrow and easily erased. And it doesn't take much. I mean, people often object to pluralization in Perl by means of @collection and $collection[member] > > That leaves me wondering why all these suggestions keep arising. > > I think what's happening is that people who've used Ruby for a while > get used to it, and then they sort of shift their readability > threshold. In other words, if you've seen this: > > a.map {|b| b.meth } > > for several years, then even though it looked beautiful and concise > and transparent to you at first, it will start to look verbose and > syntactically inefficient. So then you might want to [Compress the code by moving to a higher base :-)] > > And yet... if you had encountered the latter version first, you would > never have had the feeling of balance and cleanness that you got (or > at least I did) from the former version. > > So I think there's a kind of readability inflation going on: people > who are acclimatized to Ruby start feeling comfortable about going to > the "next" level of line-noise and/or compactness. > So what is so bad about introducing more keywords? Yes, they can stamp on existing variables, but what if, just for parameter passing we introduced "named" # A factory method def create_pizza(t=[:pepperoni, :ham] named :toppings, c=[:thin] named :crust_thickness) imaginate(:pizza_factory).make_me(c,t) # [1] end nice short vars for codeing, then # My toppings for today mt=[:ham, :cheese, :pineapple] pizza = create_pizza(mt named :toppings) There's no ambiguity with past forms, and the syntax is still fairly English. (On the basis that the rest of Ruby is fairly English: I'm not suggesting people should fit to my linguistic bias.) Ruby has very few keywords now. I know this might upset things that talk to name daemons, because they already have the named string inside the code, but if it improves readability it might be a price worth paying. Hugh [1] http://www.toolshed.com/blog/articles/2004/09/01/imaginate-the-article