đŸ’Ÿ Archived View for nytpu.com â€ș gemlog â€ș 2021-03-24.gmi captured on 2023-06-14 at 14:10:39. Gemini links have been rewritten to link to archived content

View Raw

More Information

âŹ…ïž Previous capture (2022-03-01)

âžĄïž Next capture (2024-07-08)

-=-=-=-=-=-=-

↩ go back to index

the “better c's”

march 24, 2021

Inspired by this post comparing Zig, Rust, Go, & C++ against C.

We all know that C is obsolete and should be replaced.

Serge

The linked post mirrors my experiences and opinions with all the languages he talks about (well, other than the above quote). As someone who loves and shills C at every opportunity, I also fully admit that it isn't that great for most purposes. My love for C is like my love for assembly: I absolutely adore writing in it beyond belief, but I fully recognize that it really shouldn't be use for a lot of higher level/more general programs unless you really need to squeeze out that extra performance.

There are a swath of higher-level C derivative languages that are trying to replace it, and I've experimented with a lot of them. Now, most languages today are derived from C, but that's not what I'm talking about, I'm talking about languages that reference "replacing C" as one of their reasons for being created. Examples include Go, Zig, Rust, and the like. I've tried most of them out, so I figured I might as well share my opinions on them.

c

If you've written in assembly before (you really should, even just once) then it becomes very apparent that C is a /very/ thin layer around assembly. It has decent abstractions, it obviously has a standard library that saves you a lot of bootstrap work, but it really is shockingly similar to (x86) assembly, which makes sense since that's how it was deliberately designed. People that have no experience with lower-level programmingᔃ see C as needlessly clunky, but I think they just don't realize that that's becuase C is /that close/ to machine language.

At any rate, C is definitely one the most influential languages ever, and it's very good for a whole lot of things. I wouldn't really use it for very large projects (other than high-performace stuff), but other than its atrocious string handling (particularly when dealing with unicode and/or locales) I don't see most of the the percieved “flaws” as flaws at all, it's that way for a reason.

Footnote: the most-complained about feature of C, macros, are single-handedly one of the best things ever when writing assembly, people just don't understand the proper usage of them when you're coming from a high-level perspective. They're way to easy to mess up unless you know what you're doing (just like the rest of C).

[a]: a.k.a. people who don't know how computers work and therefore don't deserve an opinion anyways

go

I've absolutely fallen in love with Go. It's very opinionated, but I happen to share most of its opinions, so it's great. I absolutely love the module system (despite google's incessant attempts to fuck it up), and I just really enjoy writing it. It's C enough for me to get the same warm feelings writing it, but also not C enough to where I get annoyed having to write everything from scratch every time. Also, Go's documentation is pretty much the best anywhere, something that is way undervalued and usually ignored on freshly-starting languages (see Zig).

Of course, the biggest problem with Go is the gaggle of googlers trying to shove their own shit into it. Now Go has technically been by google from the start, but the original engineers were basically all Bell Labs geniuses rather than whatever shit you'd call google's “engineers.” The main problem is they constantly fuck up how modules are fetchedᔇ, but even despite this the module system is far better than npm/rust style “you can only use our proprietary package repo that requires you to use github.” The fact that you can pull in any repo from any host (as long as it has the stupid meta tags) is a really strong point that I haven't seen in any other language. It's always either “download the library yourself and put it in the right import path” or “use our shitty centralized thing,” the Go Wayℱ is really revolutionary and one of the strongest points of the language.

Go makes huge binaries, but other than that it really is a great high-level language. I really love it.

[b]: at risk of linking this every single gemlog post i make, drew devault wrote on this far better than i could.

rust

If you've read anything by me regularly (particularly on the fediverse) then you'll know I have a frothing hatred for rust.

the rust evangelism strike force strikes again! not that i'd be contributing to wikimedia anyways (php), but you know what i consider the quintessential language for server development? rust of course!!!!!!! fucking genius.
i guess since the crates package system and the cargo build system is worse than npm, web devs would be attracted to it like flies to shit. the complete lack of standardization or documentation would probably attract them too.

me, February 12, 2021

A few more selected posts, taken from a personal org file dedicated enirely to “rust sucks”:

rust requires a /proprietary/ password manager in order to compile it. if you want to use crates.io, you need a github (also proprietary) account.

a rust version of cowsay uses 97 megabytes of dependencies.

https://society.kalli.st/notice/A4FFq7Uz1PnIAM1Ce8

https://tilde.zone/@nytpu/105771887549676341

https://tilde.zone/@nytpu/105756286517496138

https://tilde.zone/@nytpu/105606501857760906

At any rate, depsite hating it I have given it numerous fair chances and yet I have never seen a convincing reason to like it. As mentioned in one of the links above, I do almost-kinda-sorta like the language itself, but the crates system is shitty beyond belief and I hate the entire rust community way more than even the most toxic community of shills from any other language.

zig

I dislike LLVM, even more than I dislike GCC. The language is a little verbose for my taste. The standard library itself is a little lacking, and so is the standard library's documentation. And yet, I love Zig. I have almost no experience in it beyond a few toy programs (about to start writing something after I finish this post), but I already have feelings for it like I have for Go. If I ever pursue a dream of writing a basic OS for the RasPi from scratch, I could really see myself using Zig.

I like Go, but I see it more as a “network programming language” (if such a thing exists) rather than a “systems programming language” like C or Zig (or rust pretending to be for systems programming despite only supporing a few architectures well). Zig has pretty fuckin' awesome architecture support considering how it's such a brand-new language, I guess one of the few benefits to use LLVM. Bootstrapping Zig on a new platform/architecture is (from what I've heard) pretty easy, compared to the shitshow that is rustᔇ.

[b]: in case it isn't obvious at this point, rust is my go-to when i need an example for how to not do something when making a programming language.

found another language that i actually like?

I guess I found another language that I actually like more than halfheartedly, so that's good. I also found another excuse to write about how much I hate rust, which is always a bonus in anything I do. I guess if you want a takeawayᶜ then use Go for something more stable, easy, and entertaining to write, and Zig for the same but it's newer so a little less dependable I guess. Also use C and assembly because they're just really fun once you get into the flow of writing.

[c]: i don't know why i insist on having a takeaway at the end of every post

⁂

↩ go back to index

like this post!

view likes and comments

contact: alex@nytpu.com

backlinks

-- Copyright © 2021 nytpu - CC BY-SA 4.0