6 ms·
FWIW, another take on "C Alternative" is the D programming language: https://wiki.dlang.org/Tutorials https://wiki.dlang.org/Tutorials Comparatively mature, t
by vandyswa 1y ago
FWIW, another take on "C Alternative" is the D programming language:
https://wiki.dlang.org/Tutorials https://wiki.dlang.org/Tutorials
Comparatively mature, there's even a freeware book which is quite good:
http://www.ddili.org/ders/d.en/index.html http://www.ddili.org/ders/d.en/index.html
- macintux 1y agoWalter Bright, the creator of D, is an active commenter here. https://news.ycombinator.com/user?id=WalterBright https://news.ycombinator.com/user?id=WalterBright Zig is also worth mentioning, and pops up frequently.
- sdsd 1y agoOnce, on a previous account, he actually replied to me. It's like a kid going to guitar center and the guy who replaces your strings is Axl Rose. If you're on here, Walter, you're my hero. I also once interacted with Brendan Eich, who I admire as much for his role in web history as for his activism.
- bsrkf 1y agoI always thought it was more akin to a C++ than a C alternative, and reading https://en.wikipedia.org/wiki/D_(programming_language) https://en.wikipedia.org/wiki/D_(programming_language) seems to rather confirm this notion: "originated as a re-engineering of C++" "influenced by Java, Python, Ruby, C#, and Eiffel" "design by contract, ranges, built-in container iteration concepts, and type inference" "array slicing, nested functions and lazy evaluation." "Java-style single inheritance with interfaces and mixins" "function overloading and operator overloading" "supports five main programming paradigms" (including OOP) ... et cetera Though it does support things like in-line assembly and the like, I'm sure most C programmers would pass on it, as a C-alternative, based on those factoids.
- vandyswa 1y agoYes, I understand the C++ aspect, but I was never a C++ coder, and D "fit in my hand" in a way which made me certain that its creator had coded extensively in C and understood the aspects which made it so perfect for its time. It really felt like D, not D++ to me. (Oh, disclosure, I'm just a D user, no organizational or financial interests here.)
- lerno 1y agoD was never a C alternative, it was a C++ alternative.
- bsrkf 1y ago^ and this person (no affiliation) has a much "truer" C alternative in the making, just for everyone's information: https://c3-lang.org/ https://c3-lang.org/ Haven't gotten around to trying it out, but skimmed the documents a lot at one point. Always try to keep tabs on it, doesn't get the love it should.
- johnisgood 1y agoYeah, I have used Odin before, I am thinking of giving C3 a try as well. At a quick glance though: > Enum support various reflection properties: .values returns an array with all enums. .len or .elements returns the number of enum values, .inner returns the storage type. .names returns an array with the names of all enums. .associated returns an array of the typeids of the associated values for the enum. I do not like that the length is named ".elements" instead of just ".len". And why are there two ways, or are they not the same? Etc.
- sph 1y agoFWIW I have spent the weekend testing out C-replacement languages and their interop (linking to libsdl3 and libtcl) with D, Go, Rust, Odin and C3. My quick impressions: - D is featureful, but too much so. It feels an unfocused kitchen sink worse than C++. Overall the actual dev experience was nice. - Go I know pretty well, but saddened that CGo is very slow, so I cannot consider it truly a C replacement - Rust I also know decently well, but writing types and lifetimes isn’t my idea of fun. I’d rather have less safety when playing with code, I’m not always writing mission critical apps. Overall walks the fine line between excellent and unergonomic; pulls half a gig of dependencies just to include SDL3 which is pure madness. - Odin I have played with before, excellent for the gamedev world, but some features seems like they have been added just because the author liked them. Having to explicitly set up the context variable in cdecl callbacks feels bad. I dislike the whole context thing actually, because it is rigid though convenient. - C3: documentation is bad but feels the closest to a better C. Still in the breaking phase, I sent a PR this morning to adapt the SDL3 library to the latest release. Has macros which I haven’t tested but it’s a big plus. Some syntax makes no sense, like block labels and generic in {braces} but it’s the one I will keep playing with for this project. No one seems to use or know about it, which doesn’t bode well for its future. - Zig I haven’t used this weekend, I loathe that unused variables are errors and it is very verbose. Docs and stdlib are way undercooked. comptime is a brilliant idea. Could be decent past 1.0 release. - Jai: I’d love to try it, if I had access to the beta. A lot of paper cuts and small issues, nothing is really worthy of being called a C replacement, but I do not want to write another header file again so these will make do for now.