From: Marc Heiler Date: 2011-12-10T22:18:11+09:00 Subject: Re: reading from file without end-of-lines > What isn't elegant about the `&'? It is not elegant because the rest of the line uses . ! ? and () which are used basically everywhere else in Ruby code, whereas & is used solely for ... something related to blocks. It does not feel in-sync with the rest of the ruby code. It is confusing for newcomers as well. Just look at it again to compare: .map! &:strip! Besides, that in this example, & requires the :symbol, which is even more confusing to newcomers. I am aware that the & notation here is syntactic sugar but it is still not elegant. The person who mentioned that before me is spot on - it is not elegant at all. (Btw, ruby complained about the lack of () in this example, so the proper way would be:) .map!(&:strip!) Which is even uglier. Perl is greeting Ruby again. R. Klemme also agreed here: > Absolutely agree! We could remedy this by allowing a single > argument to Enumerable#map which would be interpreted as > method name to send to objects. OTOH, does it warrant > a change request? The problem lies with the &: notation in itself. It is shorter and thus people will use it. But it does not change the fact that it simply is ugly. I myself can live with that, but personally I'd rather explain easier syntax to newcomers to ruby - they need to understand both Symbols and Procs and methods ending in "!" when seeing this. And I feel this is somewhat needless. Just changing Enumerable#map alone isn't going to help them that much I fear. Sadly, Ruby is going that direction lately, with the introduction of the -> syntax notation, which I absolutely loathe. Perhaps others love it but I for one don't think we should evolve in a perl-tradition - in 10 years people may suddenly think that perl 6 looks better than ruby because it may have less line noise ... -- Posted via http://www.ruby-forum.com/.