Flix (programming language): Difference between revisions

Content deleted Content added
JorKadeen (talk | contribs)
JorKadeen (talk | contribs)
Line 23:
 
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]]<ref>{{cite web |title=Monomorphise |url=http://mlton.org/Monomorphise |website=mlton.org}}</ref>, 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>.