Hacker News new | ask | show | jobs
by pjmlp 40 days ago
That already exists, OCaml.

The problem with Rust is lack of alternative implementations, like it happens in OCaml and Haskell, which allow for quick development loops, or going for lunch with an heavily optimised build.

1 comments

Ocaml has a GC though, no? That makes it improper for system programming.
Only for those ideologically against GC in systems programming languages.

https://mirage.io

> Docker Desktop avoids this problem by forwarding all traffic at user-level via vpnkit, a TCP/IP stack written in OCaml on top of the network protocol libraries of the MirageOS Unikernel project.

https://www.docker.com/blog/how-docker-desktop-networking-wo...

https://ocaml.github.io/ocamlunix/ocamlunix.pdf

And to go back to the 1980s, more broadly than only OCaml,

"Eric Bier Demonstrates Cedar"

https://www.youtube.com/watch?v=z_dt7NG38V4

Or if you prefer bare metal stuff, with hard real time requirements, and somehow more mainstream language,

> Aonix PERC Ultra Virtual Machine supports Lockheed Martin's Java components in Aegis Weapon System aboard guided missile cruiser USS Bunker Hill

https://www.militaryaerospace.com/computers/article/16724324...

> Thales Air Systems Selects Aonix PERC Ultra For Java Execution on Ground Radar Systems

https://vita.militaryembedded.com/5922-thales-execution-grou...

Nowadays Aonix has been integrated into PTC.

https://www.ptc.com/en/products/developer-tools/perc

I not so versed into that debate so will gladly take input, but seeing how the “stop the world” issue seem to be for games for example, I’m cautious.
The "stop the world" also affects C code in games, when malloc() is used in a loop, and the C standard library has to do a syscall into kernel space to get a fresh memory block.

https://sourceware.org/glibc/wiki/MallocInternals

Especially relevant anything describing how mmap() and sbrk() are being called.

The matter is not if the language has a GC or not, regardless of the GC algorithm(s) being used, rather what language primitives and standard library features are available to be taken advantage of, when required to do some low level coding.

Here is another set of examples, TinyGo, TamaGo or Oberon for tiny computers.

https://www.astrobe.com

https://tinygo.org/docs/reference/microcontrollers/boards

https://reversec.com/usb-armory

> when malloc() is used in a loop

But nobody should do that, you allocate upfront.

I worked professionally in OCaml for many years, and I assure you it’s possible to write low latency code by avoiding allocations. People write Java this way as well. Lots of system software was written in OCaml this way. It looks a little un-idiomatic compared to regular OCaml code but really what’s going on is that it’s just a specific low-latency idiom. Don’t create structs, don’t match on options. Weird, right? But it works.

Some of the code also did networking in user space and communicated with other processes by coordinating writes to shared memory.

It’s true that there’s certain system software that you probably can’t write because of the presence of a GC: parts of the operating system, a language runtime, a virtualization toolkit. The category “system software” contains those things but also databases, browsers, and servers.