On Monday, 19 November 2012 at 21:44:35 UTC, Jonathan M Davis wrote:
Excep that i don't think that it's really a question of style. It's treating a function as if it were a variable, when it's not only not a variable, but it's not even acting like one. It's implying that the code has one set of semantics when it has another.

This is just an old habit to see identifier with parens as a function call and identifier without parens as a variable, so calling functions without parens seem too unconventional to you. However there are many languages which dropped this tradition and they are known for being expressive and concise, that's why people love them. Recently we saw an article from Walter about component programming which one could say was really about function composition. It's really convenient to write code in conveyor-style, this is what we see often in functional languages, as well as some dynamic OO ones. For example, the task of reversing words in a string may look like:

"one two three".split.map{|s| s.reverse}.join(' ')
in Ruby

print . unwords . map reverse . words $ "one two three"
in Haskell

"one two three" |> split " " |> List.map reverse |> String.join " " |> print_string
in OCaml
and something similar and even without dots in Scala.
Ease of chaining functions together is one of the things that make those languages so pleasant to work with. I love to have the same in current D and it would be a pity to lose it due to a clash with some old-fashioned tradition.

Reply via email to