Content deleted Content added
Line 18:
The Flix type and effect system supports [[Hindley–Milner_type_system|Hindley-Milner]]-style type inference. The system separates pure and impure code. If an expression is typed as pure then it cannot produce an effect. Higher-order functions can enforce that they are given pure function arguments or alternatively they can be effect polymorphic in the effect of their arguments. The effect inference algorithm is based on [[unification_(logic)|Boolean unification]].
==
The syntax of Flix is inspired by [[Scala]]. The type system is based on [[Hindley–Milner_type_system|Hindley-Milner]] which has been used in a wide variety of functional programming languages, including [[OCaml]], [[Haskell_(programming_language)|Haskell]], and [[Standard ML]]. The concurrency model of Flix is based on [[Communicating_sequential_processes|channels and processes]].
The Flix compiler compiles programs to [[JVM bytecode]] which is executable on the [[Java Virtual Machine]] (JVM).
The compiler performs [[whole program compilation]], eliminates polymorphism using [[monomorphization]], and uses [[tree shaking]] to remove unused code. The use of monomorphization avoids [[Value_type_and_reference_type|boxing]] of primitive types at the cost of longer compilation times and larger binaries.
Flix supports full tail call elimination<ref>{{cite journal |last1=Madsen |first1=Magnus |last2=Zarifi |first2=Ramin |last3=Lhoták |first3=Ondřej |title=Tail call elimination and data representation for functional languages on the Java virtual machine |journal=Proceedings of the 27th International Conference on Compiler Construction - CC 2018 |date=2018 |pages=139–150 |doi=10.1145/3178372.3179499}}</ref> which ensures that calls in tail position never consume stack space. Since the JVM instruction set does not support tail calls, such calls are emulated using a form of reusable stack frames<ref>{{cite journal |last1=Tauber |first1=Tomáš |last2=Bi |first2=Xuan |last3=Shi |first3=Zhiyuan |last4=Zhang |first4=Weixin |last5=Li |first5=Huang |last6=Zhang |first6=Zhenrui |last7=Oliveira |first7=Bruno C. D. S. |title=Memory-Efficient Tail Calls in the JVM with Imperative Functional Objects |journal=Programming Languages and Systems |date=2015 |volume=9458 |pages=11–28 |doi=10.1007/978-3-319-26529-2_2}}</ref>.
== Examples ==
|