3 ms·
You see, I'd like to write more of my software in Clojure (or any functionally inclined Lisp). If there was a really good interop story with a non-gc:d native l
by vnorilo 5y ago
You see, I'd like to write more of my software in Clojure (or any functionally inclined Lisp). If there was a really good interop story with a non-gc:d native lang I could do more of it.
Clojure is a hosted language, so hosting it on C++ (or Rust etc.) would be sweet for me personally. Also, I like compiler projects.
- yawaramin 5y agoCheck out https://github.com/carp-lang/Carp https://github.com/carp-lang/Carp From the readme: > The key features of Carp are the following: > - Automatic and deterministic memory management (no garbage collector or VM) > - Inferred static types for great speed and reliability > - Ownership tracking enables a functional programming style while still using mutation of cache-friendly data structures under the hood > - No hidden performance penalties – allocation and copying are explicit > - Straightforward integration with existing C code > - Lisp macros, compile time scripting and a helpful REPL
- geokon 5y agoI've never had to use it myself, but what part of the JNI/JNA is problematic? One thing I'd sorta fantasized about is (in a very hand wavey way) using Clojure + ClojureCL to run OpenCL kernels. In theory if you were to bundled your JAR with POCL.. you could selectively run your tight-loops/kernels on the CPU or GPU. So it'd be effectively like launching little C snippets. Furthermore, from what I remember, kernels are compiled and executed at run time - so it'd really fit with the whole REPL workflow and they would effectively simply be inline strings of C code that get executed I think the main catch for the moment is that ClojureCL uses a MKL matrices to talk to the OpenCL driver (driver? dispatcher? I might be mixing up my terms) - but that could be modified to a JVM container Probably my own bias - but the only time I've really been let down by Clojure and missed native was when I need to optimize a tight loop. Once you optimized Clojure past a certain point (to eliminate reflection, boxing issues, destructuring etc.) it starts to get ugly.
- didibus 5y agoInterop with C is pretty decent, but if you want to make a C++ hosted Clojure dialect I'm all for it! The more the merrier!
- geokon 5y agoIt does already sort of exist: https://ferret-lang.org/ https://ferret-lang.org/
- aidenn0 5y agoConsider perhaps https://github.com/clasp-developers/clasp https://github.com/clasp-developers/clasp which is a common-lisp specifically designed to interop with C++.
- iainctduncan 5y agoYou could check out s7 Scheme. I'm using it for music apps, and it shares a lot of Clojure's design decisions, like being fundamentally a lisp-1 but having many CL inspired features. It's very minimal, and super easy to embed in a C/C++ host. And liberally licensed.