🦀
<?php declare(strict_types=1)
😏 😁
🏃♂️💨
🏃♂️💨
The dash emoji. Always looks like a fart.
With no context, this could be an honest attempt to learn about different tools, a thinly veiled set-up to promote a specific language, or an attempt to stir up drama. I can’t tell which.
It’s curious how such specific conditions are embedded into the question with no explanation of why, yet “memory safe” is included among them without specifying what kind of memory safety.
The question mine as well be “what is your favorite compiled language?”. There is a lot of overlap between the possible answers.
Yeah, I like subleq.
- compiler is extremely fast, faster even than
tinycc
- strongly statically typed: all values are
int
s. Since it’s all of them, you don’t even need to write it! - memory safe: the entire (virtual) address space is guaranteed to be accessible at all times so there’s no way to leak any of it (can’t release it anyway) or to segfault (it’s all accessible).
Subleq is the obvious winner in my mind.
- compiler is extremely fast, faster even than
Rust
That is a very specific subset
Garbage collection is still allowed, and technically JIT languages are still compiled so it really isn’t that restrictive
Java, the language so good you compile it twice!
Not that specific tbh, most newer native languages these days are compiled and memory safe (Rust, Swift, Go, Kotlin Native, etc)
C# is good too. If you havent heard of lobster you should look into it.
C# isn’t exactly compiled, at least not into machine language. It is transpiled into byte code that is run on a virtual machine that on turn is an interpreter/JIT-compiler.
Depending on why someone is asking for a compiled language that may or may not be a problem, because to the one writing the code it looks like a compiled language, but to the one running it it looks like an interpreted one.
Not necessarily these days! With NativeAOT, C# can be compiled to machine code.
It is compiled to bye code. Just to be clear transpiling is completely different. It is also not interpreted.
But ahead of time compilation is available now. So you can compile straight machine code.
The newer tiered JIT can actually give better performance than a traditional compiler as well.
Overall C# is an awesome language. If performance is absolutely critical you can use raw pointers and manual memory management, but obviously you lose safety then.
It is compiled into bytecode. A transpiler translates to another programming language with the same level of abstraction. A compiler translates into a level that is nearer to or machine code.
As others have said, Haskell and Rust are pretty great. A language that hasn’t been mentioned that I REALLY want to catch on, though, is Unison.
Honorable mention to my main driver lately: Purescript
Ada, hands down. Every time I go to learn Rust I’m disappointed by the lack of safety. I get that it’s miles ahead of C++, but that’s not much. I get that it strikes a much better balance than Ada (it’s not too hard to get it to compile) but it still leaves a lot to be desired in terms of safe interfacing. Plus it’s memory model is more complicated than it needs to be (though Ada’s secondary stack takes some getting used to).
I wonder if any other Ada devs have experience with rust and can make a better comparison?
I would use Ada or Spark in a heartbeat if there was an easy-to-use, mature cross-platform GUI library for it.
its* memory model is
OCaml.
Swift
I started learning Go about 3 months ago and it quickly became one of my favorite languages. It feels like C with a bunch of Python niceties thrown in. And performance isn’t super critical in my work so being garbage collected is fine with me.
People don’t understand that JIT languages are still compiled, JIT literally describes when it’s compiled.
That said, F# and/or OCaml.
Hands down, Rust 🦀
Rust.