Everything is an expression

I noticed that many languages, such as Ruby and CofeeScript (a good transpiler), support everything that is an expression.

Now this makes the language a little easier to understand and definitely seems neat on the surface, but I looked, perhaps, at some scientific publications about the positives and negatives of the two approaches.

It would be useful if the publications had clear examples that compared the advantages of having everything be an expression against, well, not.

Examples in CoffeeScript and Javascript would be nice, but not required.

The concept is certainly cool, but I'm still a little unsure how revolutionary the idea really is (obviously, something revolutionary is a bit of an opinion).

Thank!

+5
source share
2 answers

There is nothing revolutionary about this. The expression-oriented approach is functional programming ,

Expression-oriented code is simpler and less cluttered than operator-oriented code, due to smaller assignments and explicit expressions return. The absence of distinction between expressions and commands allows conceptual homogeneity (see Referential transparency ) and bottom-up .

Some modern languages ​​have adopted the concepts of functional programming (for example, C #, Python , Ruby).

Some scientific understanding of the benefits of functional practices:

:

, , , , . C - (C) (CoffeeScript) .

, -, .

. JavaScript , . .

+4

" ", , , http://jashkenas.github.com/coffee-script/

, , . , , Lisp, 50- . , , , ( ).

- , , .

0

All Articles