On Thursday, March 08, 2012 15:52:37 H. S. Teoh wrote:
> Yeah, modern function composition syntax is totally backwards. This is
> most obvious when you use the f∘g notation in math. It means f(g), that
> is, apply g first, then f. So if you use this notation in functional
> programming, writing something like a∘b∘c∘d∘e∘f means run steps a..f
> *backwards*. Written on multiple lines, it totally goes against the flow
> of control. It's the programming language version of top-posting. ;-)
> 
> Unfortunately, the alternative is reverse Polish notation, which isn't
> all that readable either.
> 
> Chained object notation is a good compromise, which happens quite often
> when you use jQuery:
> 
> $(selector)
> .html(htmlcode)
> .add(more_nodes)
> .css(some_styles)
> .filter(unwanted_nodes)
> .click(click_handler)
> .show();
> 
> Writing this in function composition order would cause an instant
> quantum leap in unreadability.

Which just goes to show that it's also a question of what you're used to, 
because I find that using the order that you did here rather than normal 
function call chaining is what causes an instance quantum leap in 
unreadibility.

- Jonathan M Davis

Reply via email to