DeVault: Announcing the Hare programming language
DeVault: Announcing the Hare programming language
Posted May 2, 2022 6:55 UTC (Mon) by ddevault (subscriber, #99589)In reply to: DeVault: Announcing the Hare programming language by wtarreau
Parent article: DeVault: Announcing the Hare programming language
>Too bad the example doesn't make use of strings
Here's some string-heavy code for your consideration:
https://git.sr.ht/~sircmpwn/hare-irc
String manipulation and manual memory management goes together like oil and water. I think we've done a pretty good job nevertheless, and you can do most string operations relatively comfortably.
https://docs.harelang.org/strings
https://docs.harelang.org/regex
https://docs.harelang.org/fmt
>I don't know if it also forces to change every single line of code when using an alternate implementation of a lib
It does not; vendoring is very straightforward and does not require any rewriting of the code. You can also trivially vendor modules from the standard library.
>That said it's strange that cross compiling is still in the roadmap, given that by now it should be well known that cross-compiling should be the default approach and native compiling just a special case of it.
This is in fact how it works in Hare, we just have to glue a few pieces together to make it useful. You can compile Hare code to any supported arch like so:
$ harec -X^ -T+riscv64 example.ha | qbe -t rv64 > example.s
$ as -o example example.s
But generally Hare programs are not built like this - they're built by invoking the build driver, hare(1), which is just currently lacking the convenience flags to glue all of the bits together. Also missing is the non-trivial considerations for handling sysroots when linking to native C libraries, though thankfully most Hare programs don't link to C.
