Reia (programming language)
   HOME

TheInfoList



OR:

Elixir is a functional,
concurrent Concurrent means happening at the same time. Concurrency, concurrent, or concurrence may refer to: Law * Concurrence, in jurisprudence, the need to prove both ''actus reus'' and ''mens rea'' * Concurring opinion (also called a "concurrence"), a ...
, general-purpose
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
that runs on the BEAM
virtual machine In computing, a virtual machine (VM) is the virtualization/ emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized h ...
which is also used to implement the Erlang programming language. Elixir builds on top of Erlang and shares the same abstractions for building
distributed Distribution may refer to: Mathematics *Distribution (mathematics), generalized functions used to formulate solutions of partial differential equations *Probability distribution, the probability of a particular value or value range of a varia ...
,
fault-tolerant Fault tolerance is the property that enables a system to continue operating properly in the event of the failure of one or more faults within some of its components. If its operating quality decreases at all, the decrease is proportional to the ...
applications. Elixir also provides productive tooling and an
extensible Extensibility is a software engineering and systems design principle that provides for future growth. Extensibility is a measure of the ability to extend a system and the level of effort required to implement the extension. Extensions can be t ...
design. The latter is supported by compile-time
metaprogramming Metaprogramming is a programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyze or transform other programs, and even modify itself ...
with macros and polymorphism via protocols. Elixir is used by companies such as Ramp,
PagerDuty PagerDuty is an American cloud computing company specializing in a SaaS incident response platform for IT departments. It has been recognized by ''Forbes'' on its "Cloud 100" as well as the ''USA Today'' list for the top small and mid-sized compa ...
,
Discord Discord is a VoIP and instant messaging social platform. Users have the ability to communicate with voice calls, video calls, text messaging, media and files in private chats or as part of communities called "servers".The developer documenta ...
,
Brex Brex Inc is an American financial service and technology company based in San Francisco, California. Brex offers business credit cards and Cash Management Accounts to technology companies. Brex cards are business charge cards, which require at ...
, E-MetroTel,
Pinterest Pinterest is an American image sharing and social media service designed to enable saving and discovery of information (specifically "ideas") on the internet using images, and on a smaller scale, animated GIFs and videos, in the form of pinboard ...
, Moz, Bleacher Report, The Outline, Inverse, Divvy, FarmBot and for building
embedded systems An embedded system is a computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is ''embedded'' ...
. The community organizes yearly events in the United States, Europe, and Japan, as well as minor local events and conferences.


History

José Valim is the creator of the Elixir programming language, a research and development project created at Plataformatec. His goals were to enable higher extensibility and productivity in the Erlang VM while keeping compatibility with Erlang's ecosystem. Elixir was aimed for large-scale sites and apps. Elixir uses features of Ruby, Erlang, and Clojure to develop a "high-concurrency" and "low-latency" language. Elixir was designed to handle large data volumes. Elixir is used in telecommunication, eCommerce, and finance industries. On July 12, 2018, Honeypot released a mini-documentary on Elixir.


Versioning

Elixir mostly follows
semantic versioning Software versioning is the process of assigning either unique ''version names'' or unique ''version numbers'' to unique states of computer software. Within a given version number category (e.g., major or minor), these numbers are generally assig ...
and has only 1 major version with no plans for a second. Each of the minor versions supports a specific range of Erlang/ OTP versions. The current stable release version is .


Features

* Compiles to
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
for the Erlang Virtual Machine (BEAM) * Everything is an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, o ...
* Erlang functions can be called from Elixir, and vice versa, without
run time Run(s) or RUN may refer to: Places * Run (island), one of the Banda Islands in Indonesia * Run (stream), a stream in the Dutch province of North Brabant People * Run (rapper), Joseph Simmons, now known as "Reverend Run", from the hip-hop group ...
impact, due to compilation to Erlang bytecode * Meta programming allowing direct manipulation of
abstract syntax tree In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract syntactic structure of text (often source code) written in a formal language. Each node of the tree denotes a construct occurr ...
(AST) * Polymorphism via a mechanism called protocols. As in
Clojure Clojure (, like ''closure'') is a dynamic and functional dialect of the Lisp programming language on the Java platform. Like other Lisp dialects, Clojure treats code as data and has a Lisp macro system. The current development process is comm ...
, protocols provide a
dynamic dispatch In computer science, dynamic dispatch is the process of selecting which implementation of a polymorphic operation (method or function) to call at run time. It is commonly employed in, and considered a prime characteristic of, object-oriented ...
mechanism. However, this is not to be confused with
multiple dispatch Multiple dispatch or multimethods is a feature of some programming languages in which a function or method can be dynamically dispatched based on the run-time (dynamic) type or, in the more general case, some other attribute of more than one of ...
as Elixir protocols dispatch on a single type. * Support for documentation via Python-like docstrings in the
Markdown Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber and Aaron Swartz created Markdown in 2004 as a markup language that is appealing to human readers in its source code form. Markdown i ...
formatting language * Shared nothing concurrent programming via message passing ( Actor model) * Emphasis on
recursion Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathemati ...
and higher-order functions instead of side-effect-based looping * Lightweight concurrency utilizing Erlang's mechanisms * Railway oriented programming via the with construct * Built-in tooling for managing dependencies, code compilation, running tests, formatting code, remote debugging and more * Lazy and async collections with streams *
Pattern matching In computer science, pattern matching is the act of checking a given sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually has to be exact: "either it will or will not be ...
to promote assertive code *
Unicode Unicode, formally The Unicode Standard,The formal version reference is is an information technology standard for the consistent encoding, representation, and handling of text expressed in most of the world's writing systems. The standard, wh ...
support and
UTF-8 UTF-8 is a variable-length character encoding used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode'' (or ''Universal Coded Character Set'') ''Transformation Format 8-bit''. UTF-8 is capable of ...
strings


Examples

The following examples can be run in an iex
shell Shell may refer to: Architecture and design * Shell (structure), a thin structure ** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses ** Thin-shell structure Science Biology * Seashell, a hard o ...
or saved in a file and run from the
command line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
by typing elixir ''''. Classic
Hello world ''Hello'' is a salutation or greeting in the English language. It is first attested in writing from 1826. Early uses ''Hello'', with that spelling, was used in publications in the U.S. as early as the 18 October 1826 edition of the '' Norwich ...
example: iex> IO.puts("Hello World!") Hello World!
List comprehension A list comprehension is a syntactic construct available in some programming languages for creating a list based on existing lists. It follows the form of the mathematical ''set-builder notation'' (''set comprehension'') as distinct from the use of ...
: iex> for n <- ,2,3,4,5 rem(n, 2)

1, do: n*n , 9, 25
Pattern matching In computer science, pattern matching is the act of checking a given sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually has to be exact: "either it will or will not be ...
(destructuring): iex>
, a The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline ...
= , 2iex> a 2 iex> = iex> a "world"
Pattern matching (multiple clauses): iex> case File.read("path/to/file") do iex> -> IO.puts("found file: #") iex> -> IO.puts("missing file: #") iex> end Pipe operator: iex> "1" , > String.to_integer() , > Kernel.*(2) 2
Modules Broadly speaking, modularity is the degree to which a system's components may be separated and recombined, often with the benefit of flexibility and variety in use. The concept of modularity is used primarily to reduce complexity by breaking a s ...
: defmodule Fun do def fib(0), do: 0 def fib(1), do: 1 def fib(n), do: fib(n-2) + fib(n-1) end Sequentially spawning a thousand processes: for num <- 1..1000, do: spawn fn -> IO.puts("#") end Asynchronously performing a task: task = Task.async fn -> perform_complex_action() end other_time_consuming_action() Task.await task


Noteworthy Elixir projects

* Mix is a build automation tool that provides tasks for creating, compiling, and testing Elixir projects, managing its dependencies, and more. *
Phoenix Phoenix most often refers to: * Phoenix (mythology), a legendary bird from ancient Greek folklore * Phoenix, Arizona, a city in the United States Phoenix may also refer to: Mythology Greek mythological figures * Phoenix (son of Amyntor), a ...
is a web development framework written in Elixir which implements the server-side Model View Controller ( MVC) pattern.


See also

* Concurrent computing *
Distributed computing A distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another from any system. Distributed computing is a field of computer sci ...


References


External links


Elixir language website
{{Authority control Concurrent programming languages Functional languages Pattern matching programming languages Programming languages Programming languages created in 2012 Software using the Apache license