Scala Actors are Just Code - No Magic
dearjunior.blogspot.com
dearjunior.blogspot.com
x.apply(y) == x(y)
and the way operators are handled 1 + 2 == 1.+(2)
are fairly powerful syntactical tools which allow seemingly magic DSL stuff. Many enter programming via Java and C; languages that are far less malleable and open to seemingly built-in modification than, say, Lisp, Scala or Ruby. However, flip side of syntactical magic? Stuff like '·' (which I recently encountered in some Scala library).Or Databinder Dispatch:
Http(:/("google.com") / "bla" / "bar" << "why=so&x=y" ># foo)
Nice library, but, you know, conciseness isn't everything. (By the way, this places a POST request to http://google.com/bla/bar with request body "why=so&x=y" and delivers the response as a parsed JSON tree to foo.)A counter example that shows how to avoid the sugar would be "if expressions" in smalltalk (simplified, may differ to reality). In smalltalk, the abstract boolean class has a method 'if'. And the "true" subclass of the boolean class implements the 'if' method to execute its first parameter, while the "false" subclass implements the 'if' method to execute its second parameter.