Menu
Home Explore People Places Arts History Plants & Animals Science Life & Culture Technology
On this page
Expression-oriented programming language
Programming language where every (or nearly every) construction is an expression and thus yields a value

An expression-oriented programming language is a programming language in which 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.

Lisp and ALGOL 68 are expression-oriented languages. Pascal is not an expression-oriented language.

All functional programming languages are expression-oriented.

We don't have any images related to Expression-oriented programming language yet.
We don't have any YouTube videos related to Expression-oriented programming language yet.
We don't have any PDF documents related to Expression-oriented programming language yet.
We don't have any Books related to Expression-oriented programming language yet.
We don't have any archived web articles related to Expression-oriented programming language yet.

Criticism and prevention

See also: Assignment (computer science) § Assignment versus equality, and Relational operator § Confusion with assignment operators

Critics, including language designers,4 blame expression-orientation for an entire class of programming mistakes wherein a programmer accidentally codes an assignment expression, which replaces a variable with an expression rather than testing it for equality with that expression.

The designers of Ada and Java prevent this type of mistake by restricting control expressions to those that evaluate strictly to the boolean data type.56

The designers of Python implemented assignment as a statement rather than an expression, thus prohibiting assignment from nesting inside any other statement or expression.7 (Until version 3.8 added 'assignment expressions', with a different syntax.8)

In some expression-oriented languages, expressions that merely cause side effects return void types.

Examples

See also

References

  1. "Glossary - The Rust Programming Language". web.mit.edu. Retrieved 2022-07-06. https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/glossary.html#expression-oriented-language

  2. Syme, Don (2020-06-14). "The early history of F#". Proceedings of the ACM on Programming Languages. 4 (HOPL): 1–58. doi:10.1145/3386325. ISSN 2475-1421. https://doi.org/10.1145%2F3386325

  3. Knoldus (2018-02-08). "Expression Oriented Programming". Knoldus – Technical Insights. Retrieved 2023-08-07. https://medium.com/knoldus/expression-oriented-programming-d88f621fd3a4

  4. Java Code Conventions "10.4 Variable Assignments" https://www.oracle.com/java/technologies/javase/codeconventions-programmingpractices.html#547

  5. The Java Language Specification, Java SE 8 Edition "14.9 The if Statement" https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.9

  6. Introducing Ada https://www.adaic.org/learn/materials/intro/part4/

  7. The Python Language Reference "6.2. Assignment statements" https://docs.python.org/3/reference/simple_stmts.html#assignment

  8. "PEP 572: Assignment Expressions" https://www.python.org/dev/peps/pep-0572/

  9. Syme, Don (2020-06-14). "The early history of F#". Proceedings of the ACM on Programming Languages. 4 (HOPL): 1–58. doi:10.1145/3386325. ISSN 2475-1421. https://doi.org/10.1145%2F3386325

  10. "Functions - The Rust Programming Language". web.mit.edu. Retrieved 2022-07-06. https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/functions.html#expressions-vs-statements

  11. "COS 326: Functional Programming". www.cs.princeton.edu. Retrieved 2022-07-06. https://www.cs.princeton.edu/~dpw/courses/cos326-12/notes/type-check.php