Flix (programming language): Difference between revisions

Content deleted Content added
correct code examples
The Death of UFCS: https://github.com/flix/flix/issues/1500
 
(3 intermediate revisions by 3 users not shown)
Line 25:
== Overview ==
 
Flix is a [[programming language]] in the [[Standard ML|ML]]-family of languages. Its type and effect system is based on [[Hindley–Milner type system|Hindley-Milner]] with several extensions, including [[row polymorphism]] and [[Unification (computer science)#E-unification|Boolean unification]]. The syntax of Flix is inspired by [[Scala (programming language)|Scala]] and uses short [[Reserved word|keywords]] and [[curly braces]]. Flix supports [[Uniform Function Call Syntax|uniform function call syntax]] which allows a function call <code>f(x, y, z)</code> to be written as <code>x.f(y, z)</code>. The concurrency model of Flix is inspired by [[Go (programming language)|Go]] and based on [[Communicating sequential processes|channels and processes]]. A process is a light-weight thread that does not share (mutable) memory with another process. Processes communicate over channels which are bounded or unbounded queues of immutable messages.
 
While many programming languages support a mixture of functional and imperative programming, the Flix type and effect system tracks the purity of every expression making it possible to write parts of a Flix program in a [[Purely functional programming|purely functional style]] with purity enforced by the effect system.
Line 49:
<syntaxhighlight lang="flx">
def main(): Unit \ IO =
Console.printLineprintln("Hello World!")
</syntaxhighlight>
 
Line 240:
The following Datalog rules compute the [[transitive closure]] of the edge relation:
 
<syntaxhighlight lang="flxprolog">
Path(x, y) :- Edge(x, y).
Path(x, z) :- Path(x, y), Edge(y, z).
Line 286:
The un-directed closure of the graph can be computed by adding the rule:
 
<syntaxhighlight lang="flxprolog">
Path(x, y) :- Path(y, x).
</syntaxhighlight>