I found Elements by accident today during a google search today.
Thought I must be misinterpreting the homepage claims at first – my jaw was on the floor after reading the documentation briefly.
(Cross-language interop is really fascinating to me. In my spare time I have been studying + working on some LLVM-based tools that do codegen for bindings/transpilation from C++ headers to a few other languages, and experimenting with JIT-interpreted interop. In this same vein, GraalVM/Sulong is a marvel to me.)
I am curious, if it’s not too much of a secret – how is it that Elements is possible? Is it that you’ve written LLVM frontends for all of these languages, and when you compile an Elements application, it’s turned into homogenous LLVM bitcode so that it’s all transparent interop and there’s no marshalling/serialization cost?
Whatever it is, it’s absolutely brilliant and without a doubt one of the coolest things I’ve ever seen!
The extensions you have added to the languages are also brilliant. I especially love Contracts
– D and Ada have them and in other languages they are sorely missed. The integration of LINQ-like queryable types is fantastic as well.
One the one hand, it’s a bit of a shame that the platform isn’t OSS so that there is widespread adoption of these enhanced language features (your Pascal implementation is something to give most modern languages a run for their money IMO) but in the same sense, I get that the compiler toolchain and the platform are worth every penny.
I had a few final short questions if I could ask them:
-
I noticed from your Github that you seem to use Pascal for the majority of your codebase. Curious whether this is because of some specific reasons, or more generally just because it reads like English.
-
With the free community Swift compiler, is it possible to build shared/static libs that export a C API for FFI with other languages, and to control the layout of things like structs? IE if someone wanted to model the
vtbl
of a C++ inherited object, and manually fill out the function pointers in Swift so that it could be used in Swift ↔ C++ interop? -
How would someone who was interested in learning how to build (or just a solid understanding of) something like Elements go about it? Are there any particular recommendations you have, or topics?
Thank you ! =)
Gavin Ray