I’m putting this under “off-topic” since it doesn’t fit into usage categories, but I do believe this is a question relevant for the Julia community.
My situation is that I’m developing a class of models in Julia which I’d like to make available in other software packages that are usually written in C, C++, or Fortran; possibly Python but this is secondary. Now I could of course produce a huge Julia binary as part of a library and link that, but I’d like to explore the possibility of writing a “model evaluator” library in a more traditional compiled language. C++ is the default but I wonder whether there are other alternatives that I should consider first? Some features I’d like:
speed : the ability to optimise the last ounce of performance
easy to link external libraries (e.g. for JSON parsing, etc)
compiles into a compact library, easy to distribute and load from other codes
write code with similar structure as my Julia code
And this last point is really where my question comes in. What languages would experienced Julia developers recommend if they were forced to go outside?
interesting suggestion. Now I should maybe add that I don’t care about OpenMP, MPI parallelisation at all. The code I’m writing will be purely serial with parallelisation taken care of by the caller. (Though I very much care about SIMD, AVX type parallelisation)
If you are looking for a more “traditional” language with the same speed as Julia then I think you already listed the options…? Anything else that gets put out there is going to have the same “problem” as Julia does in that it is not nearly as widely adopted as you might wish.
I agree, and this is why most likely I will end up with C++ (unfortunately), especially if I want others to contribute as well.
But I was curious whether there is another more interesting option. E.g., if I used F, then it wouldn’t be too difficult to call C or C++ libraries and to compile it to a library that is easy to call from another C or C++ code.
It supports the open class model and multimethods via a library written in C and C preprocessor. I was thinking it might be useful to provide some sort of compiled output of Julia code or even a way to implement an interpreted mode for Julia. Two slides from “slides-cos.pdf” in https://github.com/CObjectSystem/COS/tree/master/doc:
Where the key points are that COS is compiled and linked with C and it supports many of the open class model features and multi-methods used in Julia. The “Components Overview” slide displays the COS open class model where you can see the generic functions, types and methods features which correspond directly with the Julia language features—although maybe not with the same terminology.
On the negative side, the there are some problems with some of the test programs that I have not yet had time to debug and submit a PR upstream.
On the plus side, I’m very impressed by the use of the C pre-processor macros to implement things which can result in the operations turning into some very tight (if inscrutable) code.
I really like Crystal. It’s something like “compiled Ruby”, so very nice and clean syntax, but statically type-checked and compiled. Only played around with it a bit, but that was already fun (nice type system, macros, simple C-bindings, …). There’s also more and more libraries available, see e.g. Awesome Crystal.
But if you’re on Windows it’s not ready yet for prime time (at least natively):
The Crystal compiler doesn’t run on Windows yet . But Crystal can be used with the Windows Subsystem for Linux, a compatibility-layer for Linux executables running natively on Windows 10.