Jump to content

Comparison of multi-paradigm programming languages: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Jjmerelo (talk | contribs)
Jjmerelo (talk | contribs)
m Language overview: Corrects perl6
Line 177: Line 177:
|-
|-
| [[Perl6]] || 10
| [[Perl6]] || 10
| {{yes}}<ref>[https://docs.perl6.org/language/concurrency Channels and other mechanisms]</ref> || {{yes}}<ref>[https://docs.perl6.org/type/Signature#Type_Constraints]</ref>|| {{yes}}<ref>[https://docs.perl6.org/routine/==%3E Feed operator]</ref>|| {{no}}|| {{yes}}<ref>https://github.com/perl6/doc/issues/1744#issuecomment-360565196 Cro module</ref>|| {{yes}} || {{yes}}<ref>https://perl6advent.wordpress.com/2011/12/14/meta-programming-what-why-and-how/</ref>|| {{yes}}<ref>https://perl6advent.wordpress.com/2009/12/18/day-18-roles/ Parametrized Roles</ref>|| {{yes}} || {{no}}|| {{yes}}<ref>https://docs.perl6.org/language/mop</ref>|| {{yes}}<ref>https://docs.perl6.org/language/classtut Classes and Roles </ref> || {{yes}}|| {{no}}|| {{no}}|| {{no}}
| {{yes}}<ref>[https://docs.perl6.org/language/concurrency Channels and other mechanisms]</ref> || {{yes}}<ref>[https://docs.perl6.org/type/Signature#Type_Constraints]</ref>|| {{yes}}<ref>[https://docs.perl6.org/routine/==%3E Feed operator]</ref>|| {{no}}|| {{partial|Library}}<ref>https://github.com/perl6/doc/issues/1744#issuecomment-360565196 Cro module</ref>|| {{yes}} || {{yes}}<ref>https://perl6advent.wordpress.com/2011/12/14/meta-programming-what-why-and-how/</ref>|| {{yes}}<ref>https://perl6advent.wordpress.com/2009/12/18/day-18-roles/ Parametrized Roles</ref>|| {{yes}} || {{no}}|| {{yes}}<ref>https://docs.perl6.org/language/mop</ref>|| {{yes}}<ref>https://docs.perl6.org/language/classtut Classes and Roles </ref> || {{yes}}|| {{no}}|| {{no}}|| {{no}}
|-
|-
| [[PHP]]<ref>[http://php.net/manual/en/index.php PHP Manual], [http://php.net/manual/en/language.functions.php Chapter 17. Functions]</ref><ref>[http://php.net/manual/en/index.php PHP Manual], [http://php.net/manual/en/language.oop5.php Chapter 19. Classes and Objects (PHP 5)]</ref><ref>[http://php.net/manual/en/index.php PHP Manual], [http://docs.php.net/functions.anonymous Anonymous functions]</ref> || 4
| [[PHP]]<ref>[http://php.net/manual/en/index.php PHP Manual], [http://php.net/manual/en/language.functions.php Chapter 17. Functions]</ref><ref>[http://php.net/manual/en/index.php PHP Manual], [http://php.net/manual/en/language.oop5.php Chapter 19. Classes and Objects (PHP 5)]</ref><ref>[http://php.net/manual/en/index.php PHP Manual], [http://docs.php.net/functions.anonymous Anonymous functions]</ref> || 4

Revision as of 18:56, 27 January 2018

Programming languages can be grouped by the number and types of paradigms supported.

Criticism

Some programming language researchers criticise the notion of paradigms as a classification of programming languages, e.g. Krishnamurthi.[1] They argue that many programming languages cannot be strictly classified into one paradigm, but rather include features from several paradigms. This is clearly demonstrated in the table below. (Which is silent on the level of support of different 'paradigms'.)

Paradigm summaries

A concise reference for the programming paradigms listed in this article.

  • Concurrent programming – have language constructs for concurrency, these may involve multi-threading, support for distributed computing, message passing, shared resources (including shared memory), or futures
    • Actor programming – concurrent computation with actors that make local decisions in response to the environment (capable of selfish or competitive behavior)
  • Constraint programming – relations between variables are expressed as constraints (or constraint networks), directing allowable solutions (uses constraint satisfaction or simplex algorithm)
  • Dataflow programming – forced recalculation of formulas when data values change (e.g. spreadsheets)
  • Declarative programming – describes actions (e.g. HTML describes a page but not how to actually display it)
  • Distributed programming – have support for multiple autonomous computers that communicate via computer networks
  • Functional programming – uses evaluation of mathematical functions and avoids state and mutable data
  • Generic programming – uses algorithms written in terms of to-be-specified-later types that are then instantiated as needed for specific types provided as parameters
  • Imperative programming – explicit statements that change a program state
  • Logic programming – uses explicit mathematical logic for programming
  • Metaprogramming – writing programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime
    • Template metaprogramming – metaprogramming methods in which templates are used by a compiler to generate temporary source code, which is merged by the compiler with the rest of the source code and then compiled
    • Reflective programming – metaprogramming methods in which a program modifies or extends itself
  • Object-oriented programming – uses data structures consisting of data fields and methods together with their interactions (objects) to design programs
    • Class-based – object-oriented programming in which inheritance is achieved by defining classes of objects, versus the objects themselves
    • Prototype-based – object-oriented programming that avoids classes and implements inheritance via cloning of instances
  • Pipeline programming – a simple syntax change to add syntax to nest function calls to language originally designed with none
  • Rule-based programming – a network of rules of thumb that comprise a knowledge base and can be used for expert systems and problem deduction & resolution
  • Visual programming – manipulating program elements graphically rather than by specifying them textually (e.g. Simulink); also termed diagrammatic programming[2]

Language overview

List of multi-paradigm programming languages
Language Num­ber of Para­digms Con­cur­rent Con­straints Data­flow De­clar­at­ive Dis­trib­uted Func­tion­al Meta­pro­gram­ming Gen­er­ic Im­per­at­ive Lo­gic Re­flec­tion Ob­ject-ori­ented Pipe­lines Visu­al Rule-based Oth­er para­digms
Ada[3][4][5][6][7] 5 Yes[a 1] No No No Yes No No Yes Yes No No Yes[a 2] No No No No
ALF 2 No No No No No Yes No No No Yes No No No No No No
AmigaE[citation needed] 2 No No No No No No No No Yes No No Yes[a 2] No No No No
APL 3 No No No No No Yes No No Yes No No No No No No Array (multi-dimensional)
BETA [citation needed] 3 No No No No No Yes No No Yes No No Yes[a 2] No No No No
C++ 7 (15) Yes[8][9][10] Library[11] Library[12][13] Library[14][15] Library[16][17] Yes Yes[18] Yes[a 3] Yes Library[19][20] Library[21] Yes[a 2] Yes[22] No Library[23] Array (multi-dimensional; using STL)
C# 6 (7) Yes No Library[a 4] No No Yes[a 5] No Yes Yes No Yes Yes[a 2] No No No reactive[a 6]
ChucK [citation needed] 3 Yes No No No No No No No Yes No No Yes[a 2] No No No No
Claire 2 No No No No No Yes No No No No No Yes[a 2] No No No No
Common Lisp (some other paradigms are implemented as libraries)[citation needed] 5 No No No No No Yes Yes No Yes No Yes Yes[a 2] No No No No
Curl 5 No No No No No Yes No Yes[a 3] Yes No Yes Yes[a 2] No No No No
Curry 4 Yes Yes No No No Yes No No No Yes No No No No No No
D (version 2.0)[24][25] 6 Yes[a 7] No No No No Yes Yes[26][a 3] Yes[a 3] Yes No No Yes[a 2] No No No No
Dylan[citation needed] 3 No No No No No Yes No No No No Yes Yes[a 2] No No No No
E 3 Yes No No No Yes No No No No No No Yes[a 2] No No No No
ECMAScript[27][28] (ActionScript, E4X, JavaScript, JScript) 4 (5) partial (promises, native extensions)[a 8] No No No No Yes No No Yes No Yes Yes[a 9] No No No reactive[a 10]
Embarcadero Delphi 3 No No No No No No No Yes[a 3] Yes No No Yes[a 2] No No No No
Erlang 3 Yes No No No Yes Yes No No No No No No Yes No No No
Elixir 4 Yes No No No Yes Yes Yes No No No No No Yes No No No
Elm 6 Yes No Yes Yes No Yes No Yes No No No No Yes No No reactive
F# 7 (8) Yes[a 7] No Library[a 4] Yes No Yes No Yes Yes No Yes Yes[a 2] No No No reactive[a 6]
Falcon 4 No No No No No Yes Yes No No No Yes Yes[a 2] No No No No
Fortran 4 (5) Yes No No No No Yes[a 11] No Yes[a 12] No No No Yes[a 2] No No No Array (multi-dimensional)
Go style="background:#9EFF9E;color:black;vertical-align:middle;text-align:center;" class="table-yes"|Yes No No No No No No No Yes No Yes No Yes No No No
Haskell 2? Yes No No No No Yes (lazy) No No No No No No No No No No
Io 4 Yes[a 7] No No No No Yes No No Yes No No Yes[a 9] No No No No
J [citation needed] 3 No No No No No Yes No No Yes No No Yes[a 2] No No No No
Java 6 Yes Library[29] Library[30] No No Yes No Yes Yes No Yes Yes[a 2] No No No No
Julia 9 (17) Yes Library[31] Library[32][33] Library[34] Yes Yes (eager) Yes Yes Yes Library[35] Yes Yes (multiple dispatch, not traditional single) Yes No Library[36][37] Multiple dispatch,
Array (multi-dimensional); optionally lazy[38] and reactive (with libraries)
Kotlin style="background:#9EFF9E;color:black;vertical-align:middle;text-align:center;" class="table-yes"|Yes No No No No Yes Yes Yes Yes No Yes Yes Yes No No No
LabVIEW 4 Yes No Yes No No No No No No No No Yes No Yes No No
Lava 2 No No No No No No No No No No No Yes[a 2] No Yes No No
Leda 4 No No No No No Yes No No Yes Yes No Yes[a 2] No No No No
LispWorks (version 6.0 with support for symmetric multi-processing, rules, logic (Prolog), CORBA) 9 Yes No No No Yes Yes Yes No Yes Yes Yes Yes[a 2] No No Yes No
Lua [citation needed] 3 No No No No No Yes No No Yes No No Yes[a 9] No No No No
MATLAB 6 (10) Toolbox[39] Toolbox[40] Yes[41] No Toolbox[42] No Yes[43] Yes[44] No No Yes[45] Yes[46] No Yes[47] No Array (multi-dimensional)
Nemerle 7 Yes No No No No Yes Yes Yes Yes No Yes Yes[a 2] No No No No
Object Pascal 4 Yes No No No No Yes No No Yes No No Yes[a 2] No No No No
OCaml 4 No No No No No Yes No Yes Yes No No Yes[a 2] No No No No
Oz 9 Yes Yes Yes No Yes Yes No No Yes Yes No Yes[a 2] No No Yes No
Perl [citation needed] 8 (9) Yes[48] Library[49] Yes[50] No No Yes Yes No Yes No Yes[a 2] Yes[a 2] Yes No No No
Perl6 10 Yes[51] Yes[52] Yes[53] No Library[54] Yes Yes[55] Yes[56] Yes No Yes[57] Yes[58] Yes No No No
PHP[59][60][61] 4 No No No No No Yes No No Yes No Yes Yes[a 2] No No No No
Picat[62] 8 No Yes No Yes No Yes No Yes Yes Yes No No Yes No Yes Yes
Pliant [citation needed] 3 No No No No No Yes No No Yes No No Yes[a 2] No No No No
PointDragon 3 No No No No No No No No Yes No No Yes No Yes No No
Poplog 3 No No No No No Yes No No Yes Yes No No No No No No
Prograph 3 No No Yes No No No No No No No No Yes[a 2] No Yes No No
Python 5 (10) Library[63][64] Library[65] No No Library[66] Partial Yes[67][68] Yes[69][70] Yes Library[71] Yes Yes[a 2] No No No structured
R 4 No No No No No Yes No No Yes No Yes Yes Yes[72] No No Array (multi-dimensional)
Racket 6 No No No No No Yes Yes No Yes Yes Yes Yes No No No No
ROOP 3 No No No No No No No No Yes Yes No No No No Yes No
Ruby 4 No No No No No Yes No No Yes No Yes Yes[a 2] No No No No
Rust (version 1.0.0-alpha) 6 Yes[a 7] No No No No Yes Yes[73][74] Yes[75] Yes No No Yes No No No linear, affline, and ownership types
Sather[citation needed] 2 No No No No No Yes No No No No No Yes[a 2] No No No No
Scala[76][77] 9 Yes[a 7] No Yes[a 13] Yes No Yes Yes Yes Yes No Yes Yes[a 2] No No No No
Simula[citation needed] 2 No No No No No No No No Yes No No Yes[a 2] No No No No
SISAL 3 Yes No Yes No No Yes No No No No No No No No No No
Spreadsheets 2 No No No No No Yes No No No No No No No Yes No No
Swift 3 No No No No No Yes No No Yes No No Yes[a 2] No No No block-structured
Tcl with Snit extension [citation needed] 3 No No No No No Yes[78] No No Yes No No Yes[a 9][79] No No No No
Visual Basic .NET 6 (7) Yes No Library[a 4] No No Yes No Yes Yes No Yes Yes[a 2] No No No reactive[a 6]
Windows PowerShell 6 No No No No No Yes No Yes Yes No Yes Yes[a 2] Yes No No No
Wolfram Language & Mathematica 13[80] (14) Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Knowledge Based

See also

Notes

  1. ^ rendezvous and monitor-like based
  2. ^ a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al Class-based
  3. ^ a b c d e Template metaprogramming
  4. ^ a b c using TPL Dataflow
  5. ^ only lambda support (lazy functional programming)
  6. ^ a b c using Reactive Extensions (Rx)
  7. ^ a b c d e actor programming
  8. ^ using Node.js' cluster module or child_process.fork method, web workers in the browser, etc.
  9. ^ a b c d Prototype-based
  10. ^ using Reactive Extensions (RxJS)
  11. ^ purely functional
  12. ^ parameterized classes
  13. ^ Akka Archived 2013-01-19 at the Wayback Machine

References

  1. ^ Krishnamurthi, Shriram (November 2008). "Teaching programming languages in a post-linnaean age". SIGPLAN. ACM. pp. 81–83. Not. 43, 11..
  2. ^ Bragg, S.D.; Driskill, C.G. (20–22 September 1994). "Diagrammatic-graphical programming languages and DoD-STD-2167A". IEEEXplore. IEEE.
  3. ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, Section 9: Tasks and Synchronization
  4. ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3 Annex E: Distributed Systems
  5. ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, Section 12: Generic Units
  6. ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, Section 6: Subprograms
  7. ^ Ada Reference Manual, ISO/IEC 8652:2005(E) Ed. 3, 3.9 Tagged Types and Type Extensions
  8. ^ Thread support
  9. ^ Atomics support
  10. ^ Memory model
  11. ^ Gecode
  12. ^ SystemC
  13. ^ Boost.Iostreams
  14. ^ Boolinq
  15. ^ AraRat
  16. ^ OpenMPI
  17. ^ Boost.MPI
  18. ^ Boost.MPL
  19. ^ LC++
  20. ^ Castor Archived 2013-01-25 at the Wayback Machine
  21. ^ Reflect Library
  22. ^ N3534
  23. ^ Boost.Spirit
  24. ^ D Language Feature Table
  25. ^ Phobos std.algorithm
  26. ^ D language String Mixins
  27. ^ The Little JavaScripter demonstrates fundamental commonality with Scheme, a functional language.
  28. ^ Object Oriented Programming in JavaScript gives an overview of object-oriented programming techniques in JavaScript.
  29. ^ https://jcp.org/en/jsr/detail?id=331 JSR 331: Constraint Programming API
  30. ^ https://github.com/GoogleCloudPlatform/DataflowJavaSDK Google Cloud Platform Dataflow SDK
  31. ^ https://jump.readthedocs.io/en/latest/
  32. ^ https://github.com/MikeInnes/DataFlow.jl
  33. ^ https://github.com/JuliaGizmos/Reactive.jl
  34. ^ https://github.com/davidanthoff/Query.jl Query almost anything in julia
  35. ^ https://github.com/lilinjn/LilKanren.jl A collection of Kanren implementations in Julia
  36. ^ https://github.com/abeschneider/PEGParser.jl
  37. ^ https://github.com/gitfoxi/Parsimonious.jl
  38. ^ Lazy https://github.com/MikeInnes/Lazy.jl
  39. ^ "Execute loop iterations in parallel". mathworks.com. Retrieved 21 October 2016.
  40. ^ "Write Constraints". mathworks.com. Retrieved 21 October 2016.
  41. ^ "Getting Started with SimEvents". mathworks.com. Retrieved 21 October 2016.
  42. ^ "Execute loop iterations in parallel". mathworks.com. Retrieved 21 October 2016.
  43. ^ "Execute MATLAB expression in text - MATLAB eval". mathworks.com. Retrieved 21 October 2016.
  44. ^ "Determine class of object". mathworks.com. Retrieved 21 October 2016.
  45. ^ "Class Metadata". mathworks.com. Retrieved 21 October 2016.
  46. ^ "Object-Oriented Programming". mathworks.com. Retrieved 21 October 2016.
  47. ^ "Simulink". mathworks.com. Retrieved 21 October 2016.
  48. ^ interpreter based threads
  49. ^ Moose
  50. ^ Higher Order Perl
  51. ^ Channels and other mechanisms
  52. ^ [1]
  53. ^ Feed operator
  54. ^ https://github.com/perl6/doc/issues/1744#issuecomment-360565196 Cro module
  55. ^ https://perl6advent.wordpress.com/2011/12/14/meta-programming-what-why-and-how/
  56. ^ https://perl6advent.wordpress.com/2009/12/18/day-18-roles/ Parametrized Roles
  57. ^ https://docs.perl6.org/language/mop
  58. ^ https://docs.perl6.org/language/classtut Classes and Roles
  59. ^ PHP Manual, Chapter 17. Functions
  60. ^ PHP Manual, Chapter 19. Classes and Objects (PHP 5)
  61. ^ PHP Manual, Anonymous functions
  62. ^ Picat
  63. ^ "Parallel Processing and Multiprocessing in Python". wiki.python.org. Retrieved 21 October 2016.
  64. ^ "threading — Higher-level threading interface". docs.python.org. Retrieved 21 October 2016.
  65. ^ "python-constraint". pypi.python.org. Retrieved 21 October 2016.
  66. ^ "DistributedProgramming". wiki.python.org. Retrieved 21 October 2016.
  67. ^ "Chapter 9. Metaprogramming". chimera.labs.oreilly.com. Retrieved 22 October 2016.
  68. ^ "Metaprogramming". readthedocs.io. Retrieved 22 October 2016.
  69. ^ "PEP 443 -- Single-dispatch generic functions". python.org. Retrieved 22 October 2016.
  70. ^ "PEP 484 -- Type Hints". python.org. Retrieved 22 October 2016.
  71. ^ "PyDatalog". Retrieved 22 October 2016.
  72. ^ "Magrittr: A Forward Pipe Operator for R". cran.r-project.org\accessdate=13 July 2017.
  73. ^ "The Rust macros guide". Rust. Retrieved 19 January 2015.
  74. ^ "The Rust compiler plugins guide". Rust. Retrieved 19 January 2015.
  75. ^ The Rust Reference §6.1.3.1
  76. ^ An Overview of the Scala Programming Language
  77. ^ Scala Language Specification
  78. ^ "Tcl Programming/Introduction". en.wikibooks.org. Retrieved 22 October 2016.
  79. ^ "TCLLIB - Tcl Standard Library: snitfaq:". sourceforge.net. Retrieved 22 October 2016.
  80. ^ Notes for Programming Language Experts, Wolfram Language Documentation.
  • Multiparadigm Design for C++, by Jim Coplien, 1998.
  • Constraint Solving and Planning with Picat, Book by Neng-Fa Zhou, Håkan Kjellerstrand, and Jonathan Fruhman: Constraint Solving and Planning with Picat, Springer Verlag. ISBN 9783319258812 (paper)