Programming languages are used for controlling the behavior of a machine (often a computer). Like natural languages, programming languages follow rules for syntax and semantics.
There are thousands of programming languages[1] and new ones are created every year. Few languages ever become sufficiently popular that they are used by more than a few people, but professional programmers may use dozens of languages in a career.
Most programming languages are not standardized by an international (or national) standard, even widely used ones, such as Perl or Standard ML (despite the name). Notable standardized programming languages include ALGOL, C, C++, JavaScript (under the name ECMAScript), Smalltalk, Prolog, Common Lisp, Scheme (IEEE standard), ISLISP, Ada, Fortran, COBOL, SQL, and XQuery.
The following table compares general and technical information for a selection of commonly used programming languages. See the individual languages' articles for further information.
Most programming languages will print an error message or throw an exception if an input/output operation or other system call (e.g., chmod, kill) fails, unless the programmer has explicitly arranged for different handling of these events. Thus, these languages fail safely in this regard.
Some (mostly older) languages require that programmers explicitly add checks for these kinds of errors. Psychologically, different cognitive biases (e.g., optimism bias) may affect novices and experts alike and lead them to skip these checks. This can lead to erroneous behavior.
Failsafe I/O is a feature of 1C:Enterprise, Ada (exceptions), ALGOL (exceptions or return value depending on function), Ballerina, C#, Common Lisp ("conditions and restarts" system), Curry, D (throwing on failure),[45] Erlang, Fortran, Go (unless result explicitly ignored), Gosu, Harbour, Haskell, ISLISP, Java, Julia, Kotlin, LabVIEW, Mathematica, Objective-C (exceptions), OCaml (exceptions), OpenLisp, PHP, Python, Raku, Rebol, Rexx (with optional signal on... trap handling), Ring, Ruby, Rust (unless result explicitly ignored), Scala,[46] Smalltalk, Standard ML [citation needed], Swift ≥ 2.0 (exceptions), Tcl, Visual Basic, Visual Basic .NET, Visual Prolog, Wolfram Language, Xojo, XPath/XQuery (exceptions), and Zeek.
No Failsafe I/O: AutoHotkey (global ErrorLevel must be explicitly checked), C,[47] COBOL, Eiffel (it actually depends on the library and it is not defined by the language), GLBasic (will generally cause program to crash), RPG, Lua (some functions do not warn or throw exceptions), and Perl.[48]
Some I/O checking is built in C++ (STL iostreams throw on failure but C APIs like stdio or POSIX do not)[47] and Object Pascal, in Bash[49] it is optional.
The literature on programming languages contains an abundance of informal claims about their relative expressive power, but there is no framework for formalizing such statements nor for deriving interesting consequences.[52] This table provides two measures of expressiveness from two different sources. An additional measure of expressiveness, in GZip bytes, can be found on the Computer Language Benchmarks Game.[53]
Benchmarks are designed to mimic a particular type of workload on a component or system. The computer programs used for compiling some of the benchmark data in this section may not have been fully optimized, and the relevance of the data is disputed. The most accurate benchmarks are those that are customized to your particular situation. Other people's benchmark data may have some value to others, but proper interpretation brings many challenges. The Computer Language Benchmarks Game site warns against over-generalizing from benchmark data, but contains a large number of micro-benchmarks of reader-contributed code snippets, with an interface that generates various charts and tables comparing specific programming languages and types of tests.[56]
Go supports first class functions, higher-order functions, user-defined function types, function literals, closures, and multiple return values. This rich feature set supports a functional programming style in a strongly typed language.
As a first peek into the future reflective capabilities of Kotlin, you can now access properties as first-class objects in Kotlin
set -e
{{cite book}}