Expression-oriented programming language

From Wikipedia, the free encyclopedia

An expression-oriented programming language is a programming language where every (or nearly every) construction is an expression and thus yields a value. The typical exceptions are macro definitions, preprocessor commands, and declarations, which expression-oriented languages often treat as statements rather than expressions. Some expression-oriented languages introduce a void return type to be yielded by expressions that merely cause side-effects.

ALGOL 68 and Lisp are examples of expression-oriented languages. Pascal is not an expression-oriented language. All functional programming languages are expression-oriented.


Critics, including language designers,[1] blame expression-orientation for an entire class of programming mistakes wherein a programmer introduces an assignment expression where they meant to test for equality. For example, the designers of Ada and Java were so worried about this type of mistake, they restricted control expressions to those that evaluate strictly to the boolean data type.[2][3] The designers of Python had similar worries but took the alternative strategy of implementing assignment as a statement rather than an expression, thus prohibiting assignment from nesting inside of any other statement or expression.[4]


See also



  1. ^ Java Code Conventions "10.4 Variable Assignments"
  2. ^ The Java Language Specification, Java SE 8 Edition "14.9 The if Statement"
  3. ^ Introducing Ada
  4. ^ The Python Language Reference "6.2. Assignment statements"
Retrieved from ""
This content was retrieved from Wikipedia :
This page is based on the copyrighted Wikipedia article "Expression-oriented programming language"; it is used under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC-BY-SA). You may redistribute it, verbatim or modified, providing that you comply with the terms of the CC-BY-SA