Day 2 -

June 6th

Track 1 (Olympic Room)

10:00 - 10:45

Slinc: A Library for Scala to C Interoperability

A great number of machine learning and high performance computation applications are written in Python. Python itself has gotten a reputation for being good at these kinds of tasks, despite the language itself being very low performance. Why? Because Python leverages C and C++ libraries, and it’s quite easy for it to do so.

Most development of Scala is done on the Java Virtual Machine, and Java and the JVM have not had good options for C interop compared to Python. JNI is performant, but is very difficult to write, needing either a tool to generate C++ and Java code to hook the binding into your application. JNA is simpler and only needs Java code to be written or generated to create a binding, but is slow and heavily reliant on reflection, which makes writing Scala oriented bindings difficult. JNR is faster than JNA, but suffers the same reflection issues with Scala, as well as a sore lack of documentation.

Slinc is a library being developed to change this story. Using the power of Scala 3’s type system, metaprogramming, runtime multi-stage programming, and Java 17’s Panama project, Slinc brings easy to write and use C bindings to the Scala ecosystems. Slinc is being written in the hope of making the wide swath of C libraries and code more accessible to Scala programmers in the same way that the Java ecosystem is widely accessible to us now.

Mark Hammons

I’m a programmer who specializes in the Scala programming language. Born and raised in Oklahoma, I moved to France in 2013, and have been living here since. I have a wife and a baby.


Join our conference

Subscribe and follow @ScalaDays on Twitter for the latest conference updates.