Elixir (programming language): Difference between revisions

Content deleted Content added
747pilot (talk | contribs)
m Reverted edits by 47.189.152.205 (talk) (HG) (3.4.12)
No edit summary
 
(32 intermediate revisions by 20 users not shown)
Line 1:
{{Short description|Programming language running on the Erlang virtual machine}}
{{Primary sources|date=June 2023}}
{{Infobox programming language
| name = Elixir
| title =
| logo = [[File:Elixir_programming_language_logoElixir programming language logo.pngsvg|frameless|100px170px|elixir programming language]]
| logo caption = Elixir
| paradigms = [[multi-paradigm programming language|multi-paradigm]]: [[functional programming|functional]], [[concurrent programming|concurrent]], [[distributed programming|distributed]], [[process-oriented programming|process-oriented]]
| typing = [[type system|dynamic]], [[strong typing|strong]], [[duck typing|duck]]
| influenced = [[Gleam (programming language)|Gleam]], [[LFE (programming language)|LFE]]
| platform = [[Erlang (programming language)|Erlang]]
| license = [[Apache License 2.0]]<ref>{{cite web|url=https://github.com/elixir-lang/elixir/blob/master/LICENSE|title=elixir/LICENSE at master · elixir-lang/elixir · GitHub|work=GitHub}}</ref>
Line 13 ⟶ 14:
| year = {{start date and age|2012}}
| influenced_by = [[Clojure]], [[Erlang (programming language)|Erlang]], [[Ruby (programming language)|Ruby]]
| designer = [[José Valim]]
| origin = Brazil
| latest release version = {{wikidata|property|edit|reference|P348}}
| latest release date = {{start date and age|{{wikidata|qualifier|single|P348|P577}}}}
Line 23 ⟶ 25:
'''Elixir''' is a [[functional programming|functional]], [[concurrent computing|concurrent]], [[High-level programming language|high-level]] [[General-purpose programming language|general-purpose]] [[programming language]] that runs on the [[BEAM (Erlang virtual machine)|BEAM]] [[virtual machine]], which is also used to implement the [[Erlang (programming language)|Erlang]] programming language.<ref name=":0">{{Cite news|url=https://www.eliteinfoworld.com/blog/popular-programming-languages-2018/|title=Most Popular Programming Languages of 2018 - Elite Infoworld Blog|date=2018-03-30|access-date=2018-05-08|archive-date=2018-05-09|archive-url=https://web.archive.org/web/20180509080342/https://www.eliteinfoworld.com/blog/popular-programming-languages-2018/|url-status=dead}}</ref> Elixir builds on top of Erlang and shares the same abstractions for building [[Distributed computing|distributed]], [[fault-tolerant]] applications. Elixir also provides tooling and an [[extensible]] design. The latter is supported by compile-time [[metaprogramming]] with [[Macro (computer science)|macros]] and [[polymorphism (computer science)|polymorphism]] via protocols.<ref>{{cite web |url=https://elixir-lang.org|title=Elixir | work=José Valim | access-date=2013-02-17}}</ref>
 
The community organizes yearly events in the United States,<ref>{{Cite web|title = ElixirConf|url = http://elixirconf.com/|access-date = 2018-07-11}}</ref> Europe,<ref>{{Cite web|title = ElixirConf|url = http://elixirconf.eu/|access-date = 2018-07-11}}</ref> and Japan,<ref>{{Cite web|title = Erlang & Elixir Fest|url = https://elixir-fest.jp/|access-date = 2019-02-18}}</ref> as well as minor local events and conferences.<ref>{{Cite web|title = Elixir LDN|url = http://www.elixir.london/|access-date = 2018-07-12}}</ref><ref>{{Cite web|title = EMPEX - Empire State Elixir Conference|url = http://empex.co/|access-date = 2018-07-12}}</ref>
Elixir is used by companies such as Ramp,<ref>{{Cite web|url=https://engineering.ramp.com/elixir-at-ramp|title=Elixir at Ramp|date=2021-05-24|website=Ramp|access-date=2022-02-25}}</ref> [[PagerDuty]],<ref>{{Cite web|url=https://www.pagerduty.com/blog/elixir-at-pagerduty/|title=Elixir at PagerDuty|date=2018-06-14|website=PagerDuty|access-date=2019-04-21}}</ref> [[Discord (software)|Discord]],<ref>{{cite web|url=https://discord.com/blog/how-discord-scaled-elixir-to-5-000-000-concurrent-users|title=How Discord Scaled Elixir to 5,000,000 Concurrent Users|first=Stanislav|last=Vishnevskiy|date=Jul 6, 2017|access-date=2019-04-21}}</ref> [[Brex]],<ref>{{Cite web|last=Valim|first=José|date=2020-06-23|title=Elixir at fintech with Brex|url=https://elixir-lang.org/blog/2020/06/23/growing-with-elixir-at-brex/|access-date=2020-11-14|website=elixir-lang.github.com|language=en|archive-date=2020-11-30|archive-url=https://web.archive.org/web/20201130014618/https://elixir-lang.org/blog/2020/06/23/growing-with-elixir-at-brex/|url-status=dead}}</ref> E-MetroTel,<ref>{{Cite web|url=https://www.emetrotel.com/tsd/content/whats-new-release-60|title=What's New in Release 6.0 {{!}} Documentation|website=www.emetrotel.com|access-date=2019-04-21}}</ref> [[Pinterest]],<ref>{{Cite news|title = Introducing new open-source tools for the Elixir community|newspaper=Pinterest Careers |url=https://engineering.pinterest.com/blog/introducing-new-open-source-tools-elixir-community |archive-url=https://web.archive.org/web/20151219153708/https://engineering.pinterest.com/blog/introducing-new-open-source-tools-elixir-community |archive-date=2015-12-19 |access-date = 2016-08-01}}</ref> Moz,<ref>{{Cite web|title = Unlocking New Features in Moz Pro with a Database-Free Architecture|url = https://moz.com/devblog/moz-analytics-db-free/|access-date = 2016-08-01}}</ref> [[Bleacher Report]],<ref>{{Cite web|url=https://dev.bleacherreport.com/tagged/elixir|title=Elixir|website=Bleacher Report Engineering|access-date=2019-05-22}}</ref> [[The Outline (website)|The Outline]],<ref>{{Cite web|title=Two years of Elixir at The Outline|url=https://blog.usejournal.com/two-years-of-elixir-at-the-outline-ad671a56c9ce?gi=9931fa1dcdcb|first=Dave|last=Lucia|date=Sep 24, 2018|access-date=2019-05-22}}</ref> [[Inverse (website)|Inverse]],<ref>{{Cite web|title = What big projects use Elixir?|url = https://www.quora.com/What-big-projects-use-Elixir|access-date = 2016-08-01}}</ref> Divvy,<ref>{{Cite web|title = Why Divvy uses Elixir instead of more popular coding languages.|date = 2 April 2019|url = https://medium.com/@divvyhq/why-divvy-uses-elixir-instead-of-more-popular-coding-languages-92c514dc47d0|access-date = 2019-04-30}}</ref> [[FarmBot]]<ref>{{Citation|title=The operating system and all related software that runs on FarmBot's Raspberry Pi.: FarmBot/farmbot_os|date=2019-10-28|url=https://github.com/FarmBot/farmbot_os|publisher=FarmBot|access-date=2019-10-29}}</ref> and for building [[embedded systems]].<ref>{{Cite web|title = Elixir in production interview: Garth Hitchens|date = 3 June 2015|url = http://blog.plataformatec.com.br/2015/06/elixir-in-production-interview-garth-hitches/|access-date = 2016-08-01}}</ref><ref name="nerves">{{Cite web|title = Nerves - Craft and deploy bulletproof embedded software in Elixir |url = http://nerves-project.org/|access-date = 2016-08-01}}</ref> The community organizes yearly events in the United States,<ref>{{Cite web|title = ElixirConf|url = http://elixirconf.com/|access-date = 2018-07-11}}</ref> Europe,<ref>{{Cite web|title = ElixirConf|url = http://elixirconf.eu/|access-date = 2018-07-11}}</ref> and Japan,<ref>{{Cite web|title = Erlang & Elixir Fest|url = https://elixir-fest.jp/|access-date = 2019-02-18}}</ref> as well as minor local events and conferences.<ref>{{Cite web|title = Elixir LDN|url = http://www.elixir.london/|access-date = 2018-07-12}}</ref><ref>{{Cite web|title = EMPEX - Empire State Elixir Conference|url = http://empex.co/|access-date = 2018-07-12}}</ref>
 
== History ==
José Valim is the creator ofcreated the Elixir programming language, as a [[research and development]] project created at Plataformatec. His goals were to enable higher extensibility and productivity in the Erlang VM while maintaining compatibility with Erlang's ecosystem.<ref>{{ cite AV media |url=http://vimeo.com/53221562|title=Elixir - A modern approach to programming for the Erlang VM | access-date=2013-02-17}}</ref><ref>{{ cite AV media |url=https://www.youtube.com/watch?v=IZvpKhA6t8A| archive-url=https://ghostarchive.org/varchive/youtube/20211117/IZvpKhA6t8A| archive-date=2021-11-17 | url-status=live|title=José Valim - ElixirConf EU 2017 Keynote | access-date=2017-07-14}}{{cbignore}}</ref>
 
Elixir wasis aimed at large-scale sites and apps. ElixirIt uses features of [[Ruby (programming language)|Ruby]], Erlang, and [[Clojure]] to develop a "high-concurrency" and "low-latency" language. ElixirIt was designed to handle large data volumes. Elixir is also used in the telecommunicationtelecommunications, eCommercee-commerce, and finance industries.<ref>{{ cite web |url=https://www.welcometothejungle.com/en/articles/btc-elixir-jose-valim/|title=Behinde the code: The One Who Created Elixir | access-date=2019-11-25}}</ref>
 
OnIn July2021, 12the Numerical Elixir effort was announced with the goal of bringing machine learning, 2018neural networks, HoneypotGPU releasedcompilation, adata mini-documentaryprocessing, onand computational notebooks to the Elixir ecosystem.<ref>{{Cite web|title = Numerical Elixir: A(Nx)| website=[[GitHub]] Mini-Documentary|url = https://cultgithub.honeypot.io/originalscom/elixir-the-documentarynx|access-date = 20212024-1005-3006}}</ref>
 
== Versioning ==
Elixir mostly<ref>{{Cite web|url=https://github.com/elixir-lang/elixir/issues/8076|title=Imperative Assignements are breaking the application in 1.7 update · Issue #8076 · elixir-lang/elixir|website=GitHub|language=en|access-date=2020-02-10}}</ref> follows [[semantic versioning]] and has only 1 major version with no plans for a second. Each of the minor versions supports a specific range of Erlang/[[Open Telecom Platform|OTP]] versions.<ref>{{Citation|title=Elixir is a dynamic, functional language designed for building scalable and maintainable applications: elixir-lang/elixir|date=2019-04-21|url=https://github.com/elixir-lang/elixir|publisher=Elixir|access-date=2019-04-21}}</ref> The current stable release version is {{wikidata|property|edit|reference|P348}}.
 
== Features ==
Line 48 ⟶ 50:
* Railway oriented programming via the <code>with</code> construct<ref>{{Cite web |last=Wlaschin |first=Scott |date=May 2013 |title=Railway Oriented Programming |url=https://fsharpforfunandprofit.com/rop/ |url-status=live |archive-url=https://web.archive.org/web/20210130221804/http://fsharpforfunandprofit.com/rop/ |archive-date=30 January 2021 |access-date=28 February 2021 |website=F# for Fun and Profit}}</ref>
* Hygienic [[metaprogramming]] by direct access to the [[abstract syntax tree]] (AST).<ref name="elixirhome" /> Libraries often implement small [[Domain-specific language|___domain-specific languages]], such as for databases or testing.
* Code execution at compile time. The Elixir compiler also runs on the [[BEAM (Erlang virtual machine)|BEAM]], so modules that are being compiled can immediately run code which has already been compiled.
* [[Polymorphism (computer science)|Polymorphism]] via a mechanism called protocols. [[Dynamic dispatch]], as in [[Clojure]], however, without [[multiple dispatch]] because Elixir protocols dispatch on a single type.
* Support for documentation via Python-like docstrings in the [[Markdown]] formatting language<ref name="elixirhome" />
Line 56 ⟶ 58:
The following examples can be run in an <code>iex</code> [[Shell (computing)|shell]] or saved in a file and run from the [[command line]] by typing <code>elixir ''<filename>''</code>.
 
Classic [["Hello, World!" program|Hello world]] example:
 
<syntaxhighlight lang="iex">
Line 71 ⟶ 73:
[2, 4, 6, 8, 10]
 
iex> %{values: 1..5} |> Map.get(:values) |> Enum.map(& &1 * 2) |> Enum.sum()
30
</syntaxhighlight>
Line 135 ⟶ 137:
other_time_consuming_action()
Task.await task
</syntaxhighlight>{{cn|date=June 2023}}
 
== Noteworthy Elixir projects ==
* [[Mix (build tool)|Mix]] is a build automation tool that provides tasks for creating, compiling, and testing Elixir projects, managing its dependencies, and more.<ref name="mixe">{{Cite web|title = Mix |url = https://hexdocs.pm/mix/Mix.html |access-date = 2019-04-18}}</ref>
* [[Phoenix (web framework)|Phoenix]] is a web development framework written in Elixir which implements the server-side Model View Controller ([[Model–view–controller|MVC]]) pattern.<ref name="finiks">{{Cite web|title = Overview |url = https://hexdocs.pm/phoenix/overview.html |access-date = 2019-04-18}}</ref>
 
== See also ==
Line 145 ⟶ 143:
* [[Concurrent computing]]
* [[Distributed computing]]
* [[Parallel computing]]
 
== References ==
{{Reflist|30em}}
 
== ExternalFurther linksreading ==
* {{Cite book |author1=Simon St. Laurent |author2=J. Eisenberg |date=December 22, 2016 |title=Introducing Elixir: Getting Started in Functional Programming 2nd Edition|publisher=[[O'Reilly Media]] |isbn=978-1491956779 |language=en}}
* [https://elixir-lang.org Elixir language website]
* {{Cite book |author=Sasa Juric |date=January 12, 2019 |title=Elixir in Action 2nd Edition |publisher=[[Manning Publications]] |isbn=978-1617295027 |language=en}}
 
{{Programming languages}}