Jump to content

Comparison of programming languages

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Raise exception (talk | contribs) at 13:26, 1 December 2013 (Add language). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Programming languages are used for controlling the behavior of a machine (often a computer). Like natural languages, programming languages conform to 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.

General comparison

The following table compares general and technical information for a selection of commonly used programming languages. See the individual languages' articles for further information. Please note that the following table may be missing some information.

Language Intended use Paradigm(s) Standardized?
ActionScript 3.0 Application, client-side, Web event-driven, imperative, object-oriented 1996, ECMA
Ada Application, embedded, realtime, system concurrent,[2] distributed,[3] generic,[4] imperative object-oriented,[5] procedural,[6] 1983, 2005, 2012, ANSI, ISO, GOST 27831-88[7]
Aldor Highly domain-specific, symbolic computing imperative, functional, object-oriented No
ALGOL 58 Application imperative No
ALGOL 60 Application imperative 1960, IFIP WG 2.1, ISO[8]
ALGOL 68 Application concurrent, imperative 1968, IFIP WG 2.1, GOST 27974-88,[9]
Ateji PX Parallel application object-oriented, pi calculus No
APL Application, data processing array-oriented, tacit 1989, ISO
Assembly language General any, imperative, syntax is usually highly specific, related to the target processor No
AutoHotkey GUI automation (macros), highly domain-specific imperative No
AutoIt GUI automation (macros), highly domain-specific event-driven, imperative, procedural No
BASIC Application, education imperative, procedural 1983, ANSI, ISO
BBj Application, business, Web object-oriented, procedural No
BeanShell Application, scripting functional, imperative, object-oriented, reflective In progress, JCP[10]
BitC System functional, imperative No
BLISS System procedural No
BlitzMax Application, game imperative, object-oriented, procedural No
Boo Application No
Bro domain-specific, application event-driven, imperative No
C System[11] imperative, procedural 1989, ANSI C89, ISO C90, ISO C99, ISO C11[12]
C++ Application, system generic, imperative, object-oriented, procedural, functional 1998, ISO/IEC 1998, ISO/IEC 2003, ISO/IEC 2011[13]
C# Application, business, client-side, general, server-side, Web, Robotics structured, functional,[14] generic, imperative, object-oriented, reflective, concurrent, event-driven 2000, ECMA, ISO[15]
Clarion General, business, Web functional,[16] imperative, object-oriented Un­known
Clean General functional, generic No
Clojure General concurrent, functional No
CLU General generic, imperative, object-oriented, procedural No
COBOL Application, business imperative, object-oriented 2002 (ISO/IEC 1989)
Cobra Application, business, general, Web functional, generic, imperative, object-oriented, reflective No
ColdFusion (CFML) Web object-oriented, procedural No
Common Lisp General functional, generic, imperative, object-oriented, reflective 1994, ANSI
COMAL 80 Education imperative, procedural No
Crystal 1.0.0 Education functional, imperative, procedural No
Cython Application, general, numerical computing aspect-oriented, functional, imperative, object-oriented, reflective No
D Application, system generic, generative, imperative, object-oriented, functional, concurrent No
Dart Application, Web imperative, structured, object-oriented No
Dylan Application functional, object-oriented No
Eiffel Application generic, imperative, object-oriented 2005, ECMA, ISO[17]
Erlang Application, distributed, telecom concurrent, distributed, functional No
Euphoria Application. Since the interpreter is shared for system and application code, system is not an intended use because application crashes would affect the whole system. procedural, reflective No
Factor stack-oriented No
Falcon General, Application procedural, functional, object oriented, prototype OOP, message oriented, tabular programming No
FP functional No
F# Application functional, generic, imperative, object-oriented No
Forth General imperative, stack-oriented 1994, ANSI
Fortran Application, numerical computing generic, imperative, object-oriented, procedural 1966, ANSI 66, ANSI 77, MIL-STD-1753, ISO 90, ISO 95, ISO 2003, ISO/IEC 1539-1:2010 (2008)
G2 Application, inference, expert system common graphical development and runtime environment, event-driven, imperative, object-oriented No
Gambas Application event-driven, imperative, object-oriented No
Game Maker Language Application, games event-driven, imperative, object-oriented No
GLBasic Application, games imperative, procedural, simple object-oriented No
Go Application, system concurrent, imperative No
Gosu Application, general, scripting, Web generic, imperative, object-oriented, reflective No
GraphTalk Application logic, object-oriented No
Groovy Application, general, scripting, Web aspect-oriented, imperative, object-oriented, functional In progress, JCP[18]
Harbour Application, business, data processing, general, Web declarative, functional, generic, imperative, object-oriented, procedural, reflective No
Haskell Application functional, generic, lazy evaluation 2010, Haskell 2010[19]
Haxe Application, general, Web imperative, object-oriented, functional, generic, reflective No
HyperNext Application, education event-driven, procedural, weakly typed No
Io Application, host-driven scripting imperative, object-oriented No
ISLISP General functional, generic, imperative, object-oriented 1997, ISO
J Data processing array-oriented, function-level, tacit No
JADE Application, distributed imperative, object-oriented No
Java Application, business, client-side, general, server-side, Web generic, imperative, object-oriented, reflective, concurrent De facto standard via Java Language Specification
JavaScript Client-side, Server-side, Web functional, imperative, prototype-based, reflective 1997, ECMA
Joy Research functional, stack-oriented No
K Data processing, business array-oriented, tacit Un­known
LabVIEW (G) Application, industrial instrumentation-automation dataflow, visual No
Lisp General functional Un­known
Logtalk Artificial intelligence, application event-driven, logic, object-oriented, reflective No
Lua Application, embedded scripting aspect-oriented, functional, imperative, object-oriented, procedural, reflective No[20]
Maple Symbolic computation, numerical computing procedural, functional, imperative, object-oriented, distributed No
Mathematica Symbolic language functional, procedural, imperative, logic, distributed, object-oriented No
MATLAB Highly domain-specific, numerical computing imperative, object-oriented, procedural No
Modula-2 Application, system generic, imperative 1996, ISO[21]
Modula-3 Application generic, imperative, object-oriented No
Oberon Application, system imperative, object-oriented No
Occam General concurrent, imperative, procedural, process-oriented No
Opa Web applications functional, generic, imperative, distributed No
Oxygene Application generic, imperative, object-oriented No
Oz Application, distribution, education concurrent, functional, imperative, logic, object-oriented No
Pascal Application, education imperative, procedural 1983, ISO[22]
Pawn Embedded, host-driven scripting imperative No
Perl Application, scripting, text processing, Web functional, generic, imperative, object-oriented, procedural, reflective No
PHP Server-side, Web Application, Web imperative, object-oriented,[23] procedural,[24] reflective No
PL/I Application imperative, object-oriented, procedural 1969
Plus Application, system development imperative, procedural No
Prolog Application, artificial intelligence logic 1995, ISO
PureBasic Application procedural No
Python Application, general, Web, scripting aspect-oriented, functional, imperative, object-oriented, reflective No
Racket Education, general, scripting functional, procedural, modular, object-oriented, logic, reflective, meta No
REALbasic Application procedural Un­known
REBOL Distributed dialected, functional, imperative, object-oriented No
RPG (IBM) Application, system imperative, procedural No
Ruby Application, scripting, Web aspect-oriented, functional, imperative, object-oriented, reflective 2011(JIS X 3017), 2012(ISO/IEC 30170)
Rust Application, system concurrent, functional, generic, imperative, object-oriented, reflective No
S Application, statistics functional, imperative, object-oriented, procedural No
S-Lang Application, numerical, scripting imperative, procedural No
Scala Application, distributed, Web functional, generic, imperative, object-oriented De facto standard via Scala Language Specification (SLS)
Scheme Education, general functional 1998, R6RS
Seed7 Application, general, scripting, Web multi-paradigm, extensible, object-oriented, imperative, structured, generic, reflective No
Simula Education, general discrete event simulation, event-driven, imperative, multi-threaded (quasi-parallel) program execution, object-oriented 1968
Small Basic Application, education, games component-oriented, event-driven, imperative No
Smalltalk Application, education concurrent, declarative, event-driven, object-oriented, reflective 1998, ANSI
SNOBOL Text processing Un­known
Standard ML Application functional, generic, imperative 1997, SML '97[25]
Tcl Application, scripting, Web event-driven, imperative, procedural, reflective No
Visual Basic Application, education component-oriented, event-driven, imperative No
Visual Basic .NET Application, education, Web event-driven, imperative, object-oriented No
Visual FoxPro Application data-centric, logic, object-oriented No
Visual Prolog Application declarative, event-driven, functional, imperative, logic, object-oriented No
Windows PowerShell Administration functional, imperative, object-oriented, pipeline, reflective No
XL concept programming, imperative, object-oriented No
Language Intended use Paradigm(s) Standardized?

Type systems

Brief definitions

  • A nominal type system means that the language decides whether types are compatible and/or equivalent based on explicit declarations and names.
  • A structural type system means that the language decides whether types are compatible and/or equivalent based on the definition and characteristics of the types.
  • Type checking determines whether and when types are verified. Static checking means that type errors are reported based on a program's text (source code). Dynamic checking means that type errors are reported based on a program's dynamic (run-time) behavior..
Language Type safety Type expression Type compatibility and equivalence Type checking
ActionScript 3.0 safe implicit with optional explicit typing static
Ada safe[TS 1] explicit nominal static
Aldor unsafe implicit static
ALGOL 58 safe explicit static
ALGOL 60 safe explicit static
ALGOL 68 safe explicit structural static & tagged unions
APL safe dynamic
AutoHotkey typeless n/a n/a n/a
Ateji PX safe explicit nominal static
BASIC safe explicit nominal static
BLISS typeless n/a n/a n/a
BeanShell safe nominal dynamic
Boo safe implicit with optional explicit typing static with optional dynamic typing
Bro safe implicit with optional explicit typing nominal static
C unsafe explicit nominal static
C++ (ISO/IEC 14882) unsafe explicit nominal static[TS 2]
C# unsafe[TS 3] implicit with optional explicit typing nominal static[TS 4]
Clean safe implicit static
Clojure safe implicit with optional explicit typing dynamic
COBOL safe explicit static
ColdFusion (CFML) safe implicit dynamic
Common Lisp safe implicit with optional explicit typing dynamic
Curl safe nominal
Cython safe implicit with optional explicit typing nominal (extension types) and structural (Python) dynamic with optional static typing
D unsafe[TS 3] explicit nominal static
Dylan safe dynamic
Dynace safe implicit dynamic
Eiffel safe nominal static
Erlang safe implicit dynamic
Euphoria safe explicit, implicit with objects nominal static, dynamic with objects
F# safe implicit nominal static
Falcon safe implicit structural dynamic
Forth typeless n/a n/a n/a
Fortran safe explicit[TS 5] nominal static
Gambas safe explicit nominal
GLBasic safe explicit. Non-explicit declarations available through project options nominal static
Go[26] safe implicit with optional explicit typing structural static
Gosu safe partially implicit (local type inference) nominal (subclassing) and structural (structural) static
Groovy safe implicit with optional explicit typing dynamic with optional static typing
Harbour safe implicit with optional explicit typing dynamic
Haskell safe implicit with optional explicit typing structural static
Haxe safe implicit with optional explicit typing nominal (subclassing) and structural (structural) static with optional dynamic typing
Io safe implicit dynamic
ISLISP safe dynamic
J safe dynamic
Java safe[27] explicit nominal static
JavaScript safe implicit structural dynamic
Joy safe dynamic
Lua safe implicit dynamic
Maple safe dynamic
Mathematica safe dynamic
MATLAB M-code safe dynamic
Modula-2 unsafe[TS 3] explicit nominal static
Modula-3 unsafe[TS 3] explicit structural static
Oberon safe explicit nominal static and partially dynamic[TS 6]
Objective-C safe explicit nominal (subclassing) and structural (protocols) dynamic with optional static typing[28]
OCaml safe implicit with optional explicit typing structural static
Object Pascal (Delphi) safe explicit nominal static
Opa safe implicit with optional explicit typing structural static
Oxygene unsafe implicit static
Oz safe implicit structural dynamic
Pascal unsafe[TS 3] explicit nominal static
Perl 5 implicit dynamic
Perl 6 partially implicit[TS 7] dynamic with optional static typing
PHP implicit dynamic
Plus safe explicit structural static, dynamic (optional)
Prolog dynamic
Pure dynamic
Python safe implicit structural dynamic
REBOL safe implicit dynamic
RPG (IBM) unsafe static
Ruby safe implicit structural dynamic
Rust safe implicit with optional explicit typing static with optional dynamic typing
S dynamic
S-Lang safe implicit dynamic
Scala safe partially implicit (local type inference) nominal (subclassing) and structural (structural) static
Scheme safe implicit dynamic (latent)
Simula safe static[TS 8]
Smalltalk safe implicit dynamic
Standard ML safe implicit with optional explicit typing structural static
Tcl dynamic
Visual Basic safe implicit with optional explicit typing nominal static
Visual Basic .NET unsafe[TS 3] explicit static
Visual Prolog safe partially implicit nominal static
Windows PowerShell safe implicit dynamic
XL safe nominal static
Language Type safety Type expression Type compatibility among composites Type checking
  1. ^ Unsafe operations are well isolated by a "Unchecked_" prefix.
  2. ^ with optional dynamic type casting (see dynamic_cast)
  3. ^ a b c d e f It is almost safe, unsafe features are not commonly used.
  4. ^ with optional dynamic type (see dynamic member lookup)
  5. ^ Optionally, typing can be explicitly implied by the first letter of the identifier (known as implicit typing within the Fortran community).
  6. ^ dynamic checking of type extensions i.e. inherited types
  7. ^ explicit for static types
  8. ^ optional for formal and virtual procedures

Failsafe I/O and system calls

Most programming languages will print an error message and/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 the programmer explicitly add checks for these kinds of errors. Psychologically, different cognitive biases (e.g., optimism bias) may affect novice and experts alike and these omissions can lead to erroneous behavior.

Language Failsafe I/O
Ada Yes (exceptions)
ALGOL Yes (exceptions or return value depending on function)
AutoHotkey No (global ErrorLevel must be explicitly checked)
Bro Yes
C No[FSIO 1]
C++ No[FSIO 2]
C# Yes
COBOL No
Common Lisp Yes
D Yes [citation needed]
Eiffel No - It actually depends on the library and it is not defined by the language
Erlang Yes
Falcon Yes
Fortran Yes
GLBasic No - Will generally cause program to crash
Go No
Gosu Yes
Harbour Yes
Haskell Yes
ISLISP Yes
Java Yes
Lua No (some functions do not warn or throw exceptions)
Mathematica Yes
Object Pascal (Delphi) Some
Objective-C Yes (exceptions)
OCaml Yes (exceptions)
Perl No[FSIO 3]
PHP Yes
Python Yes
REBOL Yes
Ruby Yes
Rust Yes
S Un­known
Scala Yes[29]
Standard ML Yes [citation needed]
Tcl Yes
Visual Basic Yes
Visual Prolog Yes
Language Failsafe I/O
  1. ^ gcc can warn on unchecked error status. Newer versions of Visual Studio usually throw exceptions on failed I/O when using stdio.
  2. ^ g++ can warn on unchecked error status. Newer versions of Visual Studio usually throw exceptions on failed I/O when using stdio.
  3. ^ Considerable error checking can be enabled optionally, but by default Perl is not failsafe.

Expressiveness

Language Statements ratio[30] Lines ratio[31]
C 1 1
C++ 2.5 1
Fortran 2 0.8
Java 2.5 1.5
Perl 6 6
Smalltalk 6 6.25
Python 6 6.5

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.[32] 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.[33]

The same concepts applied to measuring the expressiveness of computer programming languages can be applied to markup languages like HTML.[34]

Benchmarks

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.

Timeline of specific language comparisons

See also

References

  1. ^ As of May 2006 Diarmuid Pigott's Encyclopedia of Computer Languages hosted at Murdoch University, Australia lists 8512 computer languages.
  2. ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, Section 9: Tasks and Synchronization
  3. ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3 Annex E: Distributed Systems
  4. ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, Section 12: Generic Units
  5. ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, 3.9 Tagged Types and Type Extensions
  6. ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, Section 6: Subprograms
  7. ^ Vak.ru
  8. ^ ISO 1538:1984
  9. ^ Vak.ru
  10. ^ JSR 274
  11. ^ CM.bell-labs.com
  12. ^ ANSI C89, ISO/IEC 9899:1990, 1999, 2011
  13. ^ ISO/IEC 14882:1998, 2003, 2011
  14. ^ Codeproject.com: Functional Programming in C# 3.0 using Lambda Expression
  15. ^ ECMA-334; ISO/IEC 23270:2006
  16. ^ Softvelocity.com
  17. ^ ECMA-367; ISO/IEC 25436:2006
  18. ^ JSR 241
  19. ^ "The Haskell 2010 Language Report". Retrieved 2011-12-07. Most Haskell implementations extend the Haskell 2010 standard.
  20. ^ Version releases are accompanied with a definitive Lua Reference Manual showing full syntax and semantics; a reference implementation, and a test suite. These are used to generate other Lua VM implementations and compilers such as Kahlua and LLVM-Lua.
  21. ^ ISO/IEC 10514-1:1996
  22. ^ ISO 7185
  23. ^ PHP Manual, Chapter 19. Classes and Objects (PHP 5),
  24. ^ PHP Manual, Chapter 17. Functions
  25. ^ SMLNJ.org
  26. ^ The Go Programming Language Specification
  27. ^ Sheng Liang, Gilad Bracha. Dynamic class loading in the Java virtual machine. Volume 33, Issue 10 of ACM SIGPLAN Notices, October 1998.
  28. ^ Developer.apple.com
  29. ^ Scala runs on the Java Virtual Machine from which it inherits the runtime exception handling.
  30. ^ Data from Code Complete, p. 100. The Statements ratio column "shows typical ratios of source statements in several high-level languages to the equivalent code in C. A higher ratio means that each line of code in the language listed accomplishes more than does each line of code in C.
  31. ^ The ratio of line count tests won by each language to the number won by C when using the Compare to feature at benchmarksgame.alioth.debian.org. Last updated May, 2006. C gcc was used for C, C++ g++ was used for C++, FORTRAN G95 was used for FORTRAN, Java JDK Server was used for Java, and Smalltalk GST was used for Smalltalk.
  32. ^ From On the Expressive Power of Programming Languages, Matthias Felleisen, ESOP '90 3rd European Symposium on Programming.
  33. ^ Computer Language Benchmarks Game ranking
  34. ^ Guillaume Marceau (2009-05-30). "Guillaume Marceau: The speed, size and dependability of programming languages". Blog.gmarceau.qc.ca. Retrieved 2013-06-14.
  35. ^ http://dare.ubvu.vu.nl/bitstream/1871/2609/1/11054.pdf

Further reading