World Library  
Flag as Inappropriate
Email this Article

Expression-oriented programming language

Article Id: WHEBN0000943685
Reproduction Date:

Title: Expression-oriented programming language  
Author: World Heritage Encyclopedia
Language: English
Subject: Lasso (programming language), Action language, Constraint logic programming, Event-driven programming, Inductive logic programming
Publisher: World Heritage Encyclopedia

Expression-oriented programming language

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 mistake 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]

However, notation provokes such errors, not semantics. From the perspective of expression-orientation, the choice of assignment notation made by C-style languages, the equals sign, =, can be considered a poor choice due to the equals sign's similarity to, and hazardously small typing distance[nb 1] from the notation C-style languages choose for the equality operator, ==, make it an occasion for error. The expression-ness of assignment is not the root cause. Other language families make different notational choices for assignment[5] that do not have this problem, such as variableexpression in APL, variable <- expression in OCaml, S, and R, variable := expression in ALGOL 68 and Standard ML, or (setq variable expression) in Lisp and Scheme. Furthermore, many expression-oriented languages are also functional languages. In these languages, assignment is either rare, or, in the case of purely functional languages, impossible.

See also


  1. ^ In fact, considering the automatic repetition feature of typical computer keyboards, the minimum string distance between = and == is effectively zero, the worst possible collision.


  1. ^ Java Code Conventions "10.4 Variable Assignments"
  2. ^ Java Language Specification "14.9 The if Statement"
  3. ^ Introducing Ada
  4. ^ The Python Language Reference "6.2. Assignment statements"
  5. ^ Rigaux, Pascal (2008-08-29). "Syntax Across Languages: Assignment or Declaration". Language Study. SourceForge. Retrieved 2010-04-17. 
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.