Somebody needs to do a deep analysis of Hare, because of how Drew thinks it will save the world. I don't know the most about language design, and I would love to see somebody picking apart every flaw in the language.
I personally have some interest and fun programming in compiled, low runtime (no GC) programming languages. And just for fun I actually set Hare up on my machine and programmed non trivial programs in it.
It's exactly like you would expect: It sucks.
So, why does it suck? It even starts shitty (I'm even skipping that you're supposed to compile it yourself because why would your Linux distribution package this nonsense for you?), Hare isn't on Windows and MacOS for ideological reasons. Awesome, great to foster your community, faggot. Then there are the other things Hare doesn't have: Multithreading (I was in the hare IRC where he literally said it's not planned for the foreseeable future). As said before, Metaprogramming. Generating shared objects (Drew doesn't believe in position independent code). It uses QBE as a backend instead of LLVM or GCC.
Let me add a quote:
It's a language that absolutely nobody asked for
So why would I program in a language with no GC and small runtime, if I can't get the performance of LLVM or even fucking multithreading? With C, C++, Rust or even Zig, there is performance that I just can't get from elsewhere, but with Hare I'm bound to 1 thread? In a time where we get more cores instead of faster cores? Nigger. I mean, sure, I think we can link a C library and use a wrapper around pthread_create with a function pointer etc, but why bother?
All of this is even before I actually looked at the language itself.
My anger at this dude and the rest aside, here are the things Hare does that are good:
- No #include and at least partially sane way of including modules
use fmt;
or one can just import one symbol use fs::{flag};
. It takes the Go approach that all files in the same folder share a namespace, but whatever
- Natively supporting tagged unions
type error = !(io::error | invalid | unexpectedeof);
- It has
defer io::close(file)!;
- Native error types
- Pointers are not nullable by default, they need to be nullable explicitly:
let z: nullable *int = y;
But from my point of view, that's it. A bunch of features from the like 1980s and 1990s. Truly a marvel in modern computer science.
By the way, even though Drew DeFaggot didn't put it into his language tutorial docs, you actually
can link C libraries from Hare. You have to use
@symbol("is_Drew_a_faggot") fn is_Drew_a_faggot(param: int) int;
and you can use the function in your code. Then you have to add the same -l argument as you would for gcc to link against the .so
Now let's look at the retarded things:
- Again, no metaprogramming: You want to use a data structure? Any data structure that isn't an array? If it just contains data, prepare to do the same bullshit C programmers did for decades by abusing void pointers. If you want something more sophisticated, you have to copy-paste the same code a bunch of time. But the genius of our time, Drew, suggests you write a program that generates the Hare code for you at build time. My suggestion: Use Python for this, then trash your Hare project and continue writing Python.
- You need to put semicolons everywhere. Seriously, after closing braces of ifs and whiles and everything else. It was the one good feature of Go to throw out semicolons and they're needed everywhere?
- No
errdefer
- The last time I coded, Hare didn't check if your switch was exhaustive. You didn't even get a nice error message, your program just silently failed, if you got to a case you didn't consider.
- And I can't believe this: No fucking methods or interfaces or the like. From what I can gather, the expected workflow is, define your new type:
type Hare = struct {.......};
, then you write your "methods" (they're just functions) fn isFun(input: Hare) bool = { return false;};
, then you update your "interface" type type Language = (HolyC | Hare);
only for then to update the "generic" method:
Code:
fn isFun(input: Language) bool = { match(input){
case let in: Hare =>
return isFun(in);
case let in: HolyC =>
return true;
};
};
Why would anyone write this? Even Lua, the minimalists dream language has syntax for object orientation and methods.
I see no reason why anyone would write Hare code, except for maybe sucking Drews cock. Because Hare's shittyness is not only in what I listed here, it's also because everything it doesn't have. There's no sales pitch, no killer feature. C++, Rust, Carbon, Zig all have something they excel at, a reason why people use them. Even lolcow languages like C3 or DasBetterC.