- Comparison of programming languages
-
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 can easily use dozens of different languages during their career.
Contents
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, 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 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] BLISS System procedural No BlitzMax Application, Game imperative, object-oriented, procedural No Boo Application No C System[11] imperative, procedural 1989, ANSI C89, ISO C90/C99 C++ Application; System generic, imperative, object-oriented, procedural 2011, ISO C# Application, Business, Client-side, General, Server-Side, Web functional,[12] generic, imperative, object-oriented, reflective 2000, ECMA, ISO[13] Clarion General, Business, Web functional[14], imperative, object-oriented Unknown 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 Development 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, imperative, object-oriented No Dylan Application functional, object-oriented No Eiffel Application generic, imperative, object-oriented 2005, ECMA, ISO[15] Erlang Application, Distributed, Telecom concurrent, distributed, functional No Euphoria Application procedural No Factor stack-oriented 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 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 Go Application; System concurrent, imperative No Gosu Application, General, Scripting, System, Web generic, imperative, object-oriented, reflective No GraphTalk Application logic-oriented, object-oriented No Groovy Application, Web aspect-oriented, imperative, object-oriented In progress, JCP[16] Harbour Application, Business, Data processing, General, Web declarative, functional, generic, imperative, object-oriented, procedural, reflective No Haskell Application functional, generic, lazy evaluation 1998, Haskell 98[17] HyperNext Application, Education event-driven, procedural, weakly typed No IBM RPG Application, System imperative, procedural No Io Application, Host-driven Scripting imperative, object-oriented No 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 Yes, De-facto standard through the Java Language Specification JavaScript Client-side, Web functional, imperative, prototype-based, reflective 1997, ECMA Joy Research functional, stack-oriented No LabVIEW ("G") Application, Industrial instrumentation and automation dataflow, visual No Lisp General functional Unknown Logtalk Artificial intelligence, Application event-driven, logic, object-oriented, reflective No Lua Application, Embedded scripting aspect-oriented, functional, imperative, object-oriented, procedural, reflective No[18] Mathematica Highly domain-specific, Symbolic Computing functional, procedural No MATLAB Highly domain-specific, Numerical Computing imperative, object-oriented, procedural No Modula-2 Application; System generic, imperative 1996, ISO[19] Modula-3 Application generic, imperative, object-oriented No Oberon Application; System imperative, object-oriented No Objective-C Application imperative, object-oriented, reflective No[20] OCaml Application functional, generic, imperative, object-oriented No Object Pascal (Delphi) Application, Business, Client-side, General, Server-Side, Web aspect-oriented,[21] event-driven, functional, generic, imperative, object-oriented, procedural, reflective No Occam General concurrent, imperative, procedural, process-oriented 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 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 Yes, De-facto standard via Python Enhancement Proposals (PEP)s. REALbasic Application Unknown REBOL Distributed dialected, functional, imperative, object-oriented No Ruby Application, Scripting, Web aspect-oriented, functional, imperative, object-oriented, reflective No 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-functional, object-oriented No Scheme Education, General functional 1998, R6RS Simula Education, General discrete event simulation, event-driven, imperative, multi-threaded (quasi-parallel) program execution, object-oriented 1968 Smalltalk Application, Education concurrent, declarative, event-driven, object-oriented, reflective 1998, ANSI SNOBOL Text processing Unknown 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 Prolog Application declarative, event-driven, functional, imperative, logical, 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
- Compatibility among composite types is how functions are applied to data typed similarly to its intended type. Name-based compatibility means that functions work only on data of its intended type and declared subtypes. Property-based compatibility means that functions work on any data that has the same properties as its intended type.
- Type checking is how type errors are checked. Static checking occurs at compile-time. Dynamic checking occurs at run-time.
Language Type strength Type safety Expression of types Compatibility among composite types Type checking ActionScript 3.0 strong safe implicit with optional explicit typing static Ada strong safe[TS 1] explicit name-based partially dynamic[TS 2] Aldor strong unsafe implicit static ALGOL 58 strong safe explicit static ALGOL 60 strong safe explicit static ALGOL 68 strong safe explicit property-based static APL strong safe dynamic AutoHotkey none Ateji PX strong safe explicit name-based static BASIC varies by dialect BLISS none n/a n/a n/a n/a BeanShell strong safe name-based dynamic Boo strong safe implicit with optional explicit typing static with optional dynamic typing C strong unsafe explicit name-based static C++ (ISO/IEC 14882) strong unsafe explicit name-based static[TS 3] C# strong safe[TS 4] explicit name-based static[TS 5] Clean strong safe implicit static Clojure strong safe implicit with optional explicit typing dynamic COBOL strong static ColdFusion(CFML) strong safe implicit dynamic Common Lisp strong safe implicit with optional explicit typing dynamic Curl strong safe name-based Cython strong safe implicit with optional explicit typing name-based (extension types) and property-based (Python) dynamic with optional static typing D strong unsafe[TS 6] explicit name-based static Dylan strong safe dynamic Eiffel strong safe name-based static Erlang strong safe implicit dynamic F# strong safe implicit name-based static Forth none n/a n/a n/a n/a Fortran strong safe explicit name-based static Gambas strong safe explicit name-based Go[26] strong safe implicit with optional explicit typing property-based static Gosu strong safe partially implicit (local type inference) name-based (subclassing) and property-based (structural) static GraphTalk weak Groovy strong safe implicit with optional explicit typing dynamic Harbour strong safe implicit with optional explicit typing dynamic Haskell strong safe implicit with optional explicit typing property-based static Io strong dynamic J strong safe dynamic Java strong safe[27] explicit name-based static JavaScript weak implicit dynamic Joy strong safe dynamic Lua weak safe implicit dynamic Mathematica strong dynamic MATLAB M-code dynamic Modula-2 strong unsafe[TS 6] explicit name-based static Modula-3 strong unsafe[TS 6] explicit property-based static Oberon strong safe explicit name-based static and partially dynamic[TS 7] Objective-C weak safe explicit name-based (subclassing) and property-based (protocols) dynamic with optional static typing[28] OCaml strong safe implicit with optional explicit typing property-based static Object Pascal (Delphi) strong safe explicit name-based static Oxygene strong unsafe implicit static Oz strong safe implicit property-based dynamic Pascal strong unsafe[TS 6] explicit name-based static Perl 5 weak implicit dynamic Perl 6 partially implicit[TS 8] dynamic with optional static typing PHP weak implicit dynamic Plus strong safe explicit property-based static, dynamic (optional) Prolog strong dynamic Pure dynamic Python strong safe implicit property-based dynamic REBOL strong safe implicit dynamic Ruby strong safe implicit property-based dynamic Rust strong safe implicit with optional explicit typing static with optional dynamic typing S strong dynamic S-Lang strong safe implicit dynamic Scala strong safe partially implicit (local type inference) name-based (subclassing) and property-based (structural) static Scheme strong implicit dynamic (latent) Simula strong safe static[TS 9] Smalltalk strong safe implicit dynamic Standard ML strong safe implicit with optional explicit typing property-based static Tcl dynamic Visual Basic strong safe implicit with optional explicit typing name-based static Visual Basic .NET strong unsafe[TS 6] explicit static Visual Prolog strong safe partially implicit name-based static Windows PowerShell strong safe implicit dynamic XL strong safe name-based static Language Type strength Type safety Expression of types Compatibility among composite types Type checking - ^ Unsafe operations are well isolated by a "Unchecked_" prefix.
- ^ Dynamic type checking is used when type safety can not be determined staticly i.e. for tagged types (type extension / inheritance), numeric ranges and array bounds.
- ^ with optional dynamic type casting (see dynamic cast)
- ^ Safe, but supports unsafe code through an explicit declaration
- ^ with optional dynamic type (see dynamic member lookup)
- ^ a b c d e It is almost safe, unsafe features are not commonly used.
- ^ dynamic checking of type extensions i.e. inherited types
- ^ explicit for static types
- ^ 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. It is common for novice programmers to forget to add these checks, and even experts occasionally do so—these omissions can lead to erroneous behavior.
Language Failsafe I/O Ada Yes (exceptions) AutoHotkey No (global ErrorLevel must be explicitly checked) C No[FSIO 1] C++ No[FSIO 2] C# Yes Common Lisp Yes D Yes[citation needed] Erlang Yes Gosu Yes Harbour Yes Haskell Yes Java Yes Lua No (some functions do not warn or throw exceptions) Mathematica Unknown 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 Unknown Scala Yes[citation needed] Standard ML Yes[citation needed] Tcl Yes Visual Basic Yes Visual Prolog Yes Language Failsafe I/O - ^ gcc can warn on unchecked error status. Newer versions of Visual Studio usually throw exceptions on failed I/O when using stdio.
- ^ g++ can warn on unchecked error status. Newer versions of Visual Studio usually throw exceptions on failed I/O when using stdio.
- ^ Considerable error checking can be enabled optionally, but by default Perl is not failsafe.
Expressiveness
Language Statements ratio[29] Lines ratio[30] 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.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.[31] 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.[32]
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. See this page about flawed benchmarks and comparisons. The Computer Language Benchmarks Game site 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.
Time line of specific language comparisons
- 1973 - Comparative Notes on Algol 68 and PL/I - S. H. Valentine - February 1973
- 1976 - Evaluation of ALGOL 68, JOVIAL J3B, Pascal, Simula 67, and TACPOL Versus TINMAN - Requirements for a Common High Order Programming Language.
- 1977 - A comparison of PASCAL and ALGOL 68[1] - Andrew S. Tanenbaum - June 1977.
- 1993 - Five Little Languages and How They Grew - BLISS, Pascal, ALGOL 68, BCPL & C - Dennis M. Ritchie - April 1993.
- 2009 - On Go - oh, go on - How well will Google's Go stand up against Brand X programming language? - David Given - November 2009
See also
- Alphabetical list of programming languages
- Comparison of basic instructions of programming languages
- Comparison of programming paradigms
- Educational programming language
- Hello world program examples
- Measuring programming language popularity
- Programming language
References
- ^ As of May 2006 Diarmuid Pigott's Encyclopedia of Computer Languages hosted at Murdoch University, Australia lists 8512 computer languages.
- ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, Section 9: Tasks and Synchronization
- ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3 Annex E: Distributed Systems
- ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, Section 12: Generic Units
- ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, 3.9 Tagged Types and Type Extensions
- ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, Section 6: Subprograms
- ^ Vak.ru
- ^ ISO 1538:1984
- ^ Vak.ru
- ^ JSR 274
- ^ CM.bell-labs.com
- ^ Codeproject.com
- ^ ECMA-334; ISO/IEC 23270:2006
- ^ Softvelocity.com
- ^ ECMA-367; ISO/IEC 25436:2006
- ^ JSR 241
- ^ "The Haskell 98 Language Report". http://www.haskell.org/onlinereport/. Retrieved 2009-03-07. Most Haskell implementations extend the Haskell 98 standard.
- ^ 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.
- ^ ISO/IEC 10514-1:1996
- ^ GCC.GNU.org
- ^ Cirrus: Aspect-oriented programming in Delphi Prism
- ^ ISO 7185
- ^ PHP Manual, Chapter 19. Classes and Objects (PHP 5),
- ^ PHP Manual, Chapter 17. Functions
- ^ SMLNJ.org
- ^ The Go Programming Language Specification
- ^ Sheng Liang, Gilad Bracha. Dynamic class loading in the Java virtual machine. Volume 33, Issue 10 of ACM SIGPLAN Notices, October 1998.
- ^ Developer.apple.com
- ^ Data from Code Complete. 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.
- ^ The ratio of line count tests won by each language to the number won by C when using the Compare to feature at Shootout.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.
- ^ From On the Expressive Power of Programming Languages, Matthias Felleisen, ESOP '90 3rd European Symposium on Programming.
- ^ Computer Language Benchmarks Game ranking
Further reading
- Cezzar, Ruknet. A Guide to Programming Languages: Overview and Comparison. ISBN 978-0890068120.
External links
- 99-bottles-of-beer.net — one program in over a thousand variations and multiple languages.
- The speed, size and dependability of programming languages — charts and narrative based on The Computer Language Benchmarks Game data.
- Shapes: Source Code Size and Run Time - charts based on current Benchmarks Game data.
- Comparison of syntaxes with sample codes.
- Syntax Across Languages
- Programming Language Comparison — a comparison of nine programming languages and related information.
- Scriptometer scores — multiple comparisons of 26 programming languages.
- Comparing Web Languages in Theory and PracticePDF — research to fulfill Kristofer J. Carlson's master's degree requirements.
- PLEAC — Programming Language Examples Alike Cookbook.
- OHLOH Language Statistics — gives an indication of the popularity of programming languages in open-source projects.
- History of Programming Language Statements — history and comparison of programming languages.
Categories:- Programming language comparisons
Wikimedia Foundation. 2010.