# Julia-like compiled languages

**URL:** https://discourse.julialang.org/t/julia-like-compiled-languages/39134
**Category:** Offtopic
**Created:** [May 8, 2020, 8:01pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134 "2020-05-08T20:01:45Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)
#### Post date: [May 8, 2020, 8:01pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134/1 "2020-05-08T20:01:45Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [May 8, 2020, 10:42pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134/2 "2020-05-08T22:42:52Z")

</div>

Chapel?

---

<div class="post-metadata">

### Author: ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)
#### Post date: [May 8, 2020, 10:48pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134/3 "2020-05-08T22:48:57Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [May 8, 2020, 10:51pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134/4 "2020-05-08T22:51:52Z")

</div>

ailuJ. That is Julia, spelled as I walk back to its fold as fast as I can.

---

<div class="post-metadata">

### Author: ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)
#### Post date: [May 8, 2020, 11:01pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134/5 "2020-05-08T23:01:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)
#### Post date: [May 8, 2020, 11:14pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134/6 "2020-05-08T23:14:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Juan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juan/32/7657_2.png) [@Juan](https://discourse.julialang.org/u/Juan)
#### Post date: [May 8, 2020, 11:15pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134/7 "2020-05-08T23:15:13Z")

</div>

Maybe Nim

> **[Nim (programming language)](https://en.wikipedia.org/wiki/Nim_(programming_language))**
>
> Nim is a general-purpose, multi-paradigm, statically typed, compiled high-level systems programming language, designed and developed by a team around Andreas Rumpf. Nim is designed to be "efficient, expressive, and elegant", supporting metaprogramming, functional, message passing, procedural, and object-oriented programming styles by providing several features such as compile time code generation, algebraic data types, a foreign function interface (FFI) with C, C++, Objective-C, and Ja Nim was ...

> **[Nim Programming Language](https://nim-lang.org/)**
>
> The Nim programming language is a concise, fast programming language that compiles to C, C++ and JavaScript.

It’s very fast but has few scientific packages yet.  
[https://forum.nim-lang.org/t/5480](https://forum.nim-lang.org/t/5480)

---

<div class="post-metadata">

### Author: ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)
#### Post date: [May 8, 2020, 11:31pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134/8 "2020-05-08T23:31:10Z")

</div>

I’ve looked at arraymancer once. Indeed, this could be a very interesting option.

---

<div class="post-metadata">

### Author: ![devel-chm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/devel-chm/32/3572_2.png) [@devel-chm](https://discourse.julialang.org/u/devel-chm)
#### Post date: [May 9, 2020, 7:59pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134/9 "2020-05-09T19:59:21Z")

</div>

How about using C together with the [C Object System](https://github.com/CObjectSystem/COS)?

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](https://github.com/CObjectSystem/COS/tree/master/doc):

 ![C_Object_System](https://global.discourse-cdn.com/julialang/original/3X/e/0/e09fec14217cba96fcf719c2da7d5874d1285548.png) ![Component_Overview](https://global.discourse-cdn.com/julialang/original/3X/c/0/c0ba6056f9c62b502107b1d4666edb5405129ea7.png)

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.

---

<div class="post-metadata">

### Author: ![asprionj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asprionj/32/6856_2.png) [@asprionj](https://discourse.julialang.org/u/asprionj)
#### Post date: [May 9, 2020, 8:41pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134/10 "2020-05-09T20:41:34Z")

</div>

I really like [Crystal](https://crystal-lang.org/). 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](https://github.com/veelenga/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](https://msdn.microsoft.com/en-us/commandline/wsl/about), a compatibility-layer for Linux executables running natively on Windows 10.

---

<div class="post-metadata">

### Author: ![thautwarm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thautwarm/32/37760_2.png) [@thautwarm](https://discourse.julialang.org/u/thautwarm)
#### Post date: [May 9, 2020, 8:51pm UTC](https://discourse.julialang.org/t/julia-like-compiled-languages/39134/11 "2020-05-09T20:51:00Z")

</div>

I’m planning to implement a Julia based language and compile things via [GitHub - tshort/StaticCompiler.jl: Compiles Julia code to a standalone library (experimental)](https://github.com/tshort/StaticCompiler.jl) .
