Arbitrary abbreviations in phobos considered ridiculous

deadalnix deadalnix at gmail.com
Thu Mar 8 14:54:21 PST 2012


Le 08/03/2012 07:15, Jonathan M Davis a écrit :
> 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

You got tricked by your experience. You are used to read backward. The 
function are written in the order they are executed in the example 
above. This isn't very traditional, and may be the reverse order of what 
people expect due to previous experience, but definitively is the 
forward way.


More information about the Digitalmars-d mailing list