Expression Orientation
   HOME

TheInfoList



OR:

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 Macro (or MACRO) may refer to: Science and technology * Macroscopic, subjects visible to the eye * Macro photography, a type of close-up photography * Image macro, a picture with text superimposed * Monopole, Astrophysics and Cosmic Ray Observat ...
definitions, preprocessor commands, and declarations, which expression-oriented languages often treat as statements.
Lisp A lisp is a speech impairment in which a person misarticulates sibilants (, , , , , , , ). These misarticulations often result in unclear speech. Types * A frontal lisp occurs when the tongue is placed anterior to the target. Interdental lisping ...
and ALGOL 68 are expression-oriented languages.
Pascal Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, Fren ...
is not an expression-oriented language. All functional programming languages are expression-oriented.


Criticism and prevention

Critics, including language designers, 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 Ada may refer to: Places Africa * Ada Foah, a town in Ghana * Ada (Ghana parliament constituency) * Ada, Osun, a town in Nigeria Asia * Ada, Urmia, a village in West Azerbaijan Province, Iran * Ada, Karaman, a village in Karaman Province, Tur ...
and Java prevent this type of mistake by restricting control expressions to those that evaluate strictly to the boolean data type. The designers of Python implemented assignment as a statement rather than an expression, thus prohibiting assignment from nesting inside any other statement or expression. (Until version 3.8 added 'assignment expressions', with a different syntax.) In some expression-oriented languages, expressions that merely cause side effects return void types.


Examples

* ALGOL 68 * BLISS * Icon *
Lisp A lisp is a speech impairment in which a person misarticulates sibilants (, , , , , , , ). These misarticulations often result in unclear speech. Types * A frontal lisp occurs when the tongue is placed anterior to the target. Interdental lisping ...
* ML * Perl * Rebol * Ruby * Haskell * Rust * Scala * Kotlin *
OCaml OCaml ( , formerly Objective Caml) is a general-purpose programming language, general-purpose, multi-paradigm programming language which extends the Caml dialect of ML (programming language), ML with object-oriented programming, object-oriented ...


See also

* Command–query separation * Functional programming


References

{{Reflist Programming language classification