Hacker News new | ask | show | jobs
by nickcw 759 days ago
Hare looks like an interesting language.

Though this limitation will limit its adoption in this multicore age I think:

From the FAQ https://harelang.org/documentation/faq.html

....

Can I use multithreading in Hare?

Probably not.

We prefer to encourage the use of event loops (see unix::poll or hare-ev) for multiplexing I/O operations, or multiprocessing with shared memory if you need to use CPU resources in parallel.

It is, strictly speaking, possible to create threads in a Hare program. You can link to libc and use pthreads, or you can use the clone(2) syscall directly. Operating systems implemented in Hare, such as Helios, often implement multi-threading.

However, the upstream standard library does not make reentrancy guarantees, so you are solely responsible for not shooting your foot off.

3 comments

> multiprocessing with shared memory if you need to use CPU resources in parallel

This is actually pretty powerful. I personally prefer it for most purposes, because it restricts the possibility of data races to only the shared memory regions. It's a little like an "unsafe block" of memory with respect to data races.

I changed from a strong threads believer and dynamic libraries plugins, exactly because of attack vector and host program stability.
> However, the upstream standard library does not make reentrancy guarantees, so you are solely responsible for not shooting your foot off.

Well, that not only rules out multi-threading, but also usage in interrupts. Quite a limitation for a "systems programming language" methinks.

I just wish it had closures