Порівняння мов програмування
Мови програмування (англ. Comparison of programming languages) використовуються для управління поведінкою машини (частіше комп'ютера). Як і людські мови, мови програмування відповідають правилам синтаксису і семантики. Зараз існують тисячі мов програмування і щороку створюються нові. З цих мов не всі стають популярними, деякі з них просто використовуються невеликою кількістю людей, але професійні програмісти можуть користуватися десятками мов у своїй кар'єрі.
Основна порівняльна таблиця
У таблиці порівнюється загальна і технічна інформація для вибору частіше використовуваних мов програмування. Увага! У цій таблиці можуть бути відсутні деякі відомості.
| Мова | Передбачуване використанняFo | Імперативне | Об'єктно-орієнтоване | Функційне | Процедурне | Узагальнене | Рефлективне | Подійно-орієнтоване | Інші парадигми | Стандартизована? |
|---|---|---|---|---|---|---|---|---|---|---|
| ActionScript 3.0 | Додатки, клієнт-сервер, веб | X | X | X | 1996, ECMA | |||||
| Ada | Додатки, вбудовані системи, системи реального часу, системне програмування | X | X | X[1] | X[2] | паралельні,[3] розподілені[4] обчислення | 1983, 2005, 2012, ANSI, ISO, ГОСТ 27831-88[5] | |||
| Aldor | Предметно-орієнтована, символьні обчислення | X | X | X | Ні | |||||
| ALGOL 58 | Додатки | X | Ні | |||||||
| ALGOL 60 | Додатки | X | 1960, IFIP WG 2.1, ISO[6] | |||||||
| ALGOL 68 | Додатки | X | паралельні обчислення | 1968, IFIP WG 2.1, GOST 27974-88,[7] | ||||||
| Ateji PX | Паралельні додатки | X | пі-числення | Ні | ||||||
| APL | Додатки, обробка даних | масиво-орієнтоване, «мовчазне» програмування | 1989, ISO | |||||||
| Мова асемблера | General | X | any, syntax is usually highly specific, related to the target processor | Ні | ||||||
| AutoHotkey | GUI automation (macros), highly domain-specific | X | Ні | |||||||
| AutoIt | GUI automation (macros), highly domain-specific | X | X | X | Ні | |||||
| BASIC | Application, education | X | X | 1983, ANSI, ISO | ||||||
| BBj | Application, business, Web | X | X | Ні | ||||||
| BeanShell | Application, scripting | X | X | X | X | In progress, JCP[8] | ||||
| BitC | System | X | X | Ні | ||||||
| BLISS | System | X | Ні | |||||||
| BlitzMax | Application, game | X | X | X | Ні | |||||
| Boo | Application | Ні | ||||||||
| Bro | domain-specific, application | X | X | Ні | ||||||
| C | Application, system,[9] general purpose, low-level operations | X | X | 1989, ANSI C89, ISO C90, ISO C99, ISO C11[10] | ||||||
| C++ | Application, system | X | X | X | X | X | 1998, ISO/IEC 1998, ISO/IEC 2003, ISO/IEC 2011[11] | |||
| C# | Application, RAD, business, client-side, general, server-side, Web, Robotics | X | X | X[12] | X | X | X | structured, concurrent | 2000, ECMA, ISO[13] | |
| Clarion | General, business, Web | X | X | X[14] | Невідомий | |||||
| Clean | General | X | X | Ні | ||||||
| Clojure | General | X | concurrent | Ні | ||||||
| CLU | General | X | X | X | X | Ні | ||||
| COBOL | Application, business | X | X | X | ANSI X3.23 1968, 1974, 1985; ISO/IEC 1989:1985, 2002, 2014 | |||||
| Cobra | Application, business, general, Web | X | X | X | X | X | Ні | |||
| ColdFusion (CFML) | Web | X | X | Ні | ||||||
| Common Lisp | General | X | X | X | X | X | 1994, ANSI | |||
| Мова | Intended use | Imperative | Об'єктно-орієнтоване | Functional | Procedural | Generic | Reflective | Event-Driven | Інші парадигми | Стандартизована? |
| COMAL 80 | Education | X | X | Ні | ||||||
| Crystal 1.0.0 | Education | X | X | X | Ні | |||||
| Cython | Application, general, numerical computing | X | X | X | X | aspect-oriented | Ні | |||
| D | Application, system | X | X | X | X | generative, concurrent | Ні | |||
| Dart | Application, Web | X | X | structured | Ні | |||||
| Dylan | Application | X | X | Ні | ||||||
| Eiffel | Application | X | X | X | 2005, ECMA, ISO[15] | |||||
| Erlang | Application, distributed, telecom | X | concurrent, distributed | Ні | ||||||
| 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. | X | X | Ні | ||||||
| Factor | stack-oriented | Ні | ||||||||
| Falcon | General, Application | X | X | X | prototype OOP, message oriented, tabular programming | Ні | ||||
| FP | X | Ні | ||||||||
| F# | Application | X | X | X | X | Ні | ||||
| Forth | General | X | stack-oriented | 1994, ANSI | ||||||
| Fortran | Application, numerical computing | X | X | X | X | 1966, ANSI 66, ANSI 77, MIL-STD-1753, ISO 90, ISO 95, ISO 2003, ISO/IEC 1539-1:2010 (2008) | ||||
| FreeBASIC | Application, numerical computing | X | X | X | X | Ні | ||||
| G2 | Application, inference, expert system | X | X | X | common graphical development and runtime environment | Ні | ||||
| Gambas | Application | X | X | X | Ні | |||||
| Game Maker Language | Application, games | X | X | X | Ні | |||||
| GLBasic | Application, games | X | X | X | simple object-oriented | Ні | ||||
| Go | Application, system | X | concurrent | Ні | ||||||
| Gosu | Application, general, scripting, Web | X | X | X | X | Ні | ||||
| GraphTalk | Application | X | logic | Ні | ||||||
| Groovy | Application, general, scripting, Web | X | X | X | aspect-oriented | In progress, JCP[16] | ||||
| Harbour | Application, business, data processing, general, Web | X | X | X | X | X | X | declarative | Ні | |
| Haskell | Application | X | X | lazy evaluation | 2010, Haskell 2010[17] | |||||
| Haxe | Application, general, Web | X | X | X | X | X | Ні | |||
| HyperNext | Application, education | X | X | weakly typed | Ні | |||||
| HyperTalk | Application, RAD, General | X | X | weakly typed | Невідомо | |||||
| Io | Application, host-driven scripting | X | X | Ні | ||||||
| Мова | Intended use | Imperative | Об'єктно-орієнтоване | Functional | Procedural | Generic | Reflective | Event-Driven | Інші парадигми | Стандартизована? |
| ISLISP | General | X | X | X | X | 1997, ISO | ||||
| J | Data processing | array-oriented, function-level, tacit | Ні | |||||||
| JADE | Application, distributed | X | X | Ні | ||||||
| Java | Application, business, client-side, general, server-side, Web | X | X | X | X | concurrent | De facto standard via Java Language Specification | |||
| JavaScript | Client-side, Server-side, Web | X | X | X | X | prototype-based | 1997, ECMA | |||
| Joy | Research | X | stack-oriented | Ні | ||||||
| K | Data processing, business | array-oriented, tacit | Невідомо | |||||||
| Kotlin | Application, mobile development, server-sider, client-side, Web (JavaScript, HTML, CSS) | X | X | X | X | |||||
| LabVIEW (G) | Application, industrial instrumentation-automation | dataflow, visual | Ні | |||||||
| Lisp | General | X | Невідомо | |||||||
| Livecode | Application, RAD, General | X | X | weakly typed | Ні | |||||
| Logtalk | Artificial intelligence, application | X | X | X | logic | Ні | ||||
| Lua | Application, embedded scripting | X | X[18] | X | X | X | aspect-oriented | Ні[19] | ||
| Maple | Symbolic computation, numerical computing | X | X | X | X | distributed | Ні | |||
| Mathematica | Symbolic language | X | X | X | X | logic, distributed | Ні | |||
| MATLAB | Highly domain-specific, numerical computing | X | X | X | Ні | |||||
| Modula-2 | Application, system | X | X | 1996, ISO[20] | ||||||
| Modula-3 | Application | X | X | X | Ні | |||||
| Oberon | Application, system | X | X | Ні | ||||||
| Object Pascal (Delphi) | Application, general, mobile App, Web | X | X | X | X | X | X | structured | Ні | |
| Objective-C | Application, general | X | X | X | concurrent | Ні | ||||
| Occam | General | X | X | concurrent, process-oriented | Ні | |||||
| Opa | Web applications | X | X | X | distributed | Ні | ||||
| Oxygene | Application | X | X | X | Ні | |||||
| Oz | Application, distribution, education | X | X | X | concurrent, logic | Ні | ||||
| Pascal | Application, education | X | X | 1983, ISO[21] | ||||||
| Pawn | Embedded, host-driven scripting | X | Ні | |||||||
| Perl | Application, scripting, text processing, Web | X | X | X | X | X | X | Ні | ||
| PHP | Server-side, Web Application, Web | X | X[22] | X[23] | X | Ні | ||||
| PL/I | Application | X | X | X | 1969 | |||||
| Мова | Intended use | Imperative | Об'єктно-орієнтоване | Functional | Procedural | Generic | Reflective | Event-Driven | Інші парадигми | Стандартизована? |
| Plus | Application, system development | X | X | Ні | ||||||
| Prolog | Application, artificial intelligence | logic | 1995, ISO | |||||||
| PureBasic | Application | X | Ні | |||||||
| Python | Application, general, Web, scripting, AI, scientific computing | X | X | X | X | aspect-oriented | Ні | |||
| Racket | Education, general, scripting | X | X | X | X | modular, logic, meta | Ні | |||
| REALbasic | Application | X | Невідомо | |||||||
| REBOL | Distributed | X | X | X | dialected | Ні | ||||
| IBM RPG | Application, system | X | X | Ні | ||||||
| Ruby | Application, scripting, Web | X | X | X | X | aspect-oriented | 2011(JIS X 3017), 2012(ISO/IEC 30170) | |||
| Rust | Application, system | X | X | X | X | X | concurrent | Ні | ||
| S | Application, statistics | X | X | X | X | Ні | ||||
| S-Lang | Application, numerical, scripting | X | X | Ні | ||||||
| Scala | Application, distributed, Web | X | X | X | X | X | X | De facto standard via Scala Language Specification (SLS) | ||
| Scheme | Education, general | X | 1998, R6RS | |||||||
| Seed7 | Application, general, scripting, Web | X | X | X | X | multi-paradigm, extensible, structured | Ні | |||
| Simula | Education, general | X | X | X | discrete event simulation, multi-threaded (quasi-parallel) program execution | 1968 | ||||
| Small Basic | Application, education, games | X | X | component-oriented | Ні | |||||
| Smalltalk | Application, education | X | X | X | concurrent, declarative | 1998, ANSI | ||||
| SNOBOL | Text processing | Невідомо | ||||||||
| Standard ML | Application | X | X | X | 1997, SML '97[24] | |||||
| Swift | Application, general | X | X | X | X | concurrent | Ні | |||
| Tcl | Application, scripting, Web | X | X | X | X | Ні | ||||
| Visual Basic | Application, RAD, education, business, general, (Includes VBA), office automation | X | X | X | component-oriented | Ні | ||||
| Visual Basic .NET | Application, RAD, education, Web, business, general | X | X | X | X | X | Ні | |||
| Visual FoxPro | Application | X | data-centric, logic | Ні | ||||||
| Visual Prolog | Application | X | X | X | X | declarative, logic | Ні | |||
| Windows PowerShell | Administration | X | X | X | X | pipeline | Ні | |||
| XL | X | X | concept programming | Ні | ||||||
| Xojo | Application, RAD, General, Web | X | X | X | X | X | Ні | |||
| Мова | Intended use | Imperative | Об'єктно-орієнтоване | Functional | Procedural | Generic | Reflective | Event-Driven | Інші парадигми | Standardized? |
Типи систем
Короткі визначення
- Номінальний тип системи означає, що вирішується сумісність типізації та/або еквівалент на основі очевидних оголошень та імен.
- Структурний тип системи означає, що вирішується сумісність типізації та/або еквівалент на основі визначення і характеристики типів.
- Типом перевірки визначається, чи будуть перевіряються типи, як і коли.
Статична перевірка означає, що помилки типу повідомляються на основі тексту програми (вихідного коду). Динамічна перевірка означає, що помилки типу повідомляються на основі динаміки чи іншій програмі (під час виконання) поведінки.
| Мова | 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 | nominal | 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[25] | 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[26] | explicit | nominal | static |
| JavaScript | safe | implicit | structural | dynamic |
| Joy | safe | dynamic | ||
| Kotlin | safe | partially implicit (local type inference) | nominal | static |
| LabVIEW | safe | |||
| 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 | dynamic with optional static typing[27] |
| 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 | |
| IBM RPG | 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) | |
| Seed7 | safe | explicit | nominal | static |
| 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 | |
| Xojo | safe | explicit | nominal | static |
- Unsafe operations are well isolated by a "Unchecked_" prefix.
- with optional dynamic type casting (see dynamic cast)
- It is almost safe, unsafe features are not commonly used.
- with optional dynamic type (see dynamic member lookup)
- Optionally, typing can be explicitly implied by the first letter of the identifier (known as implicit typing within the Fortran community).
- dynamic checking of type extensions i.e. inherited types
- explicit for static types
- optional for formal and virtual procedures
Відгук системи
Більшість мов програмування виводять повідомлення про помилки та/або винятки якщо операція не виконана. Нижче наведені мови виводять ці повідомлення.
| Мова | Failsafe I/O |
|---|---|
| Ada | Так (exceptions) |
| ALGOL | Так (exceptions or return value depending on function) |
| AutoHotkey | Ні (global ErrorLevel must be explicitly checked) |
| Bro | Так |
| C | Ні[FSIO 1] |
| C++ | Ні[FSIO 2] |
| C# | Так |
| COBOL | Ні |
| Common Lisp | Так |
| D | Так[джерело?] |
| Eiffel | Ні – It actually depends on the library and it is not defined by the language |
| Erlang | Так |
| Falcon | Так |
| Fortran | Так |
| GLBasic | Ні – Will generally cause program to crash |
| Go | Ні |
| Gosu | Так |
| Harbour | Так |
| Haskell | Так |
| ISLISP | Так |
| Java | Так |
| Kotlin | Так |
| LabVIEW | Так |
| Lua | Ні (some functions do not warn or throw exceptions) |
| Mathematica | Так |
| Object Pascal (Delphi) | Деякі |
| Objective-C | Так (exceptions) |
| OCaml | Так (exceptions) |
| Perl | Ні[FSIO 3] |
| PHP | Так |
| Python | Так |
| REBOL | Так |
| Ruby | Так |
| Rust | Так |
| S | Невідомий |
| Scala | Так[28] |
| Standard ML | Так[джерело?] |
| Tcl | Так |
| Visual Basic | Так |
| Visual Prolog | Так |
| Xojo | Так |
| 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.
Посилання
- 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
- Scriptometer scores — multiple comparisons of 26 programming languages.
- 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.
- Top 20 Most Popular Programming Languages of 2017 - Research of Most Popular Programming Languages.
- Best Programming Languages to Learn in 2022 - Research of the most promising programming languages to learn.
Примітки
- Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, Section 6: Subprograms
- Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, Section 12: Generic Units
- 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
- Vak.ru
- ISO 1538:1984
- Vak.ru
- JSR 274
- CM.bell-labs.com
- ANSI C89, ISO/IEC 9899:1990, 1999, 2011
- ISO/IEC 14882:1998, 2003, 2011
- Codeproject.com: Functional Programming in C# 3.0 using Lambda Expression
- ECMA-334; ISO/IEC 23270:2006
- Softvelocity.com
- ECMA-367; ISO/IEC 25436:2006
- JSR 241
- The Haskell 2010 Language Report. Процитовано 7 грудня 2011. Most Haskell implementations extend the Haskell 2010 standard.
- Lua doesn't have explicit "object" type (more general type of "table" is used for object definition), but does have explicit syntax for object method calling
- 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
- 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
- Scala runs on the Java Virtual Machine from which it inherits the runtime exception handling.