Ron M <rm_rails / cheapcomplexdevices.com> wrote:

> For us people with less broad exposure to esoteric languages, this:
>     c.map{|b| b.meth}
> really isn't as intuitive as you'd think.
>
> If I were to ask people around the office, I'd expect guesses
> like these for  "c.map{|b| b.meth}":
>
>   ? It defines a function with the funny name "c.map" that takes
>     no arguments; that pipes the variable b it's input to b and
>     then to b.meth (like MSFT's Monad shell's pipe operator)?
>
>   ? It uses "c" to return a hashtable ("map" sounds like HashMap
>     in Java) with one element with name "b" and value "b.meth"?
>
>   ? It takes the locations in the object "c" and plots
>     the meth labs on the google-map "b"?

Well, *did* you actually ask?  What about showing your colleagues a short 
Ruby program that contains this like of code and collecting their 
interpretation?  That would certainly be interesting to hear.  IMHO context 
helps a great deal in understanding previously unknown concepts.

> In defense of "{|x| ...}",  I really like it over C-style for
> loops.  But readability for new users certainly isn't one of
> it's strengths.
>
>
>
> Consider Microsoft's Monad's
>
>   get-childitem | sort-object extension | foreach { $_.filename}
>
> vs Ruby's
>
>   get-childitem.sort_by{|child| child.extension}.map{|child|
> child.filename}
> Msh makes Ruby's 4-time repetition of "child" look quite tedious,
> without adding any readability that I can see over the Microsoft
> version.

Well, it depends: your line full of pipe symbols looks like a line from a 
bourne shell script to me... :-)  I guess you really need some kind of basic 
knowledge in either case.

>> 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.
>
> I'd reiterate that I think it's the opposite.  Newbies without
> the theoretical CS backgrounds are complaining about the parts
> that they find confusing or tedious.

It interesting to see how people make different observations: to me it looks 
as if I more often read "wow, Ruby is so cool and I can even read it 
although I'm a newby".

> The one really great part about Ruby, though; is that almost any
> time someone complains, someone else posts some magical addition
> to some module that gives the complainer almost exactly what he
> wanted -- so I'd tend to agree the language shouldn't need many
> of these changes.

Agreed.

> But I think what's driving the increased requests are mostly
> things that people find hard to read, rather than clean
> things that people are getting bored with.

Maybe it's not exactly boredom but the human drive to constantly improve 
things which is especially strong in engineers and similar folks.  While 
this force is often good there are many places where too much degrades 
things (I'm thinking of the over engineered cars of some German 
manufacturers...).  That hard part is to identify the optimum and stick with 
that.  Also, the optimum may change over time, as requirements change.

A general advantage of conservatism is that it doesn't create too many 
different variants for the same or similar concept thus limiting the overall 
size of the playing field.  And this in turn helps people a lot to get 
started.  Just compare learning curves for natural languages with comlex 
rules and syntax with those of languages with only few principles applied 
consequently.

Kind regards

    robert