Arbitrary abbreviations in phobos considered ridiculous

Jonathan M Davis jmdavisProg at gmx.com
Wed Mar 7 22:15:21 PST 2012


On Thursday, March 08, 2012 00:52:57 Nick Sabalausky wrote:
> "Ary Manzana" <ary at esperanto.org.ar> wrote in message
> news:jj94mb$1i7v$1 at digitalmars.com...
> 
> > Here's something I wrote today:
> > 
> > parent_ids = results.map{|x|
> > x['_source']['parent_ids']}.flatten.uniq.compact
> > Hash[Site.find(parent_ids).map{|x| [x.id, x]}]
> 
> When you format it like that (that is to say, when you *don't* format it),
> yea, it's unreadable. Which is why I do such things like this:
> 
> parent_ids =
>     results
>     .map{|x| x['_source']['parent_ids']}
>     .flatten.uniq
>     .compactHash[
>         Site.find(parent_ids).map{|x| [x.id, x]}
>     ]

I actually tend to find code like that hard to read, because all of the 
operations are inside out in comparison to normal. But since the only 
difference between his example and yours is the formatting, I agree yours is 
easier to read. Still, I'd much prefer if such code didn't use UFCS, since I 
find it much harder to read that way. It's just so backwards.

- Jonathan M Davis


More information about the Digitalmars-d mailing list