I've noticed many languages like Ruby and CofeeScript (well a transcompiler) support everything being an expression.
Now it makes the language somewhat simple to understand and definitely seems neat at the surface, but I was looking maybe for some scholarly publications about the positives and negatives of the two approaches.
It would be beneficial if the publications had clear examples that compared the benefits of having everything be an expression vs., well, not.
The concept is definitely cool, but I'm still slightly unsure how revolutionary the whole idea really is (obviously something being revolutionary is somewhat an opinion).
Expression-oriented code is simpler and less cluttered than statement-oriented code, because of fewer assignments and no explicit
return statements. The lack of distinction between expressions and commands enables conceptual uniformity (see Referential transparency) and bottom-up structure.
Some modern languages have adopted functional programming concepts (e.g. C#, Python, Ruby).
Some scholarly insight on the benefits of functional practices:
- Can Programming Be Liberated from the von Neumann Style? A Functional Style and Its Algebra of Programs - John Backus
As to the comment about performance concerns, the possible overhead related to choice of paradigm is probably negligible. Even in C, most statements evaluate as an expression - however, a comparison between a compiled language (C) and an interpreted language (CoffeeScript) is rather useless.
On a theoretical note, an imperative language represents the control flow in more of a machine-oriented way, which may allow for easier hand-optimization than a functional language.
By "everything is an expression," I assume you mean what is described at http://jashkenas.github.com/coffee-script/
It kinda sounds like what you're asking about are functional languages. Consider, for example, Lisp, which did this sort of thing back in the '50s. This ultimately comes out of the Lambda Calculus, in which code and data are really the same thing, and you can pass code around as though it were data (because it is).
I don't know of any scholarly articles discussing this specifically, but now you at least have some more keywords to search for.
©2020 All rights reserved.