Earlier quoted context omitted.
Cheerleading laws to be enforced is the opposite of cheerleading the introduction of a lawless society.
Their underlying point is that you're actually being very selective in which laws you want enforced. For starters, I doubt you've brayed as loudly for the prosecution of business owners who employ illegal migrants, as you are for the migrants themselves. (You certainly didn't mention illegal biz owners in this comment chain.) Likewise, the crimes ICE commits already exceed the crimes of those they're hunting, but you…
Zig Libc
171–180 of 196 posts
Re: Zig Libc
#172Earlier quoted context omitted.
That's something I've always admired about Zig. A lot of languages claim to be a C replacement, but Zig is the second language I've seen that seemed like it had a reasonable plan to do so at any appreciable scale. The language makes working with the C ABI pretty easy, but it also has a build system that can seamlessly integrate Zig and C together, as well as having a translate-c that actually works shockingly well in…
D can import C files directly, and can do C-source to D-source translation. D can compile a project with a C and a D source file with: dmd foo.d bar.c ./foo
Re: Zig Libc
#173Earlier quoted context omitted.
D can import C files directly, and can do C-source to D-source translation. D can compile a project with a C and a D source file with: dmd foo.d bar.c ./foo
Do you have to bring up D in every Zig related post? I do like D. I've written a game in it and enjoyed it a lot. I would encourage others to check it out. But it's not a C replacement. BetterC feels like an afterthought. A nice bonus. Not a primary focus. E.g. the language is designed to use exceptions for error handling, so of course there's no feature for BetterC dedicated to error handling. Being a better C is th…
One interesting result of ImportC is that it is an enhanced implementation of C in that it can do forward references, Compile Time Function Execution, and even imports! (It can also translate C source code to D source code!)
Re: Zig Libc
#174Earlier quoted context omitted.
C++ is more C-like than Zig and Rust, so it's more likely to become a C replacement.
I do feel like allowing for in-place source upgrading was critical to C++'s early successes. However, I feel like this ultimately worked against C++, since it also wed the language to many of C's warts and footguns.
BTW, in my C days, I did a lot of clever stuff with the preprocessor. I was very proud of it. One day I decided to replace the clever macros with core C code, and was quite pleased with the clean result.
With D modules, imports, static if, manifest constants, and templates the macro processor can be put on the ash heap of history. Why doesn't C++ deprecate cpp?
Re: Zig Libc
#175Re: Zig Libc
#176Earlier quoted context omitted.
D can import C files directly, and can do C-source to D-source translation. D can compile a project with a C and a D source file with: dmd foo.d bar.c ./foo
> C-source to D-source translation. I'm not so familiar with D, what is the state of this sort of feature? Is it a built-in tool, or are you talking about the ctod project I found? In most languages, I've found that source translation features to be woefully lacking and almost always require human intervention. By contrast, it feels like Zig's `translate-c` goes the extra mile in trying to convert the source to somet…
Well, most macros. The macros that do metaprogramming are not translatable. I read that Zig's translator has the same issue, which is hardly surprising since it is not possible.
So, yes, the translation is not perfect. But the result works out of the box most of the time, and what doesn't translate is easily fixed by a human. Another issue is every C compiler has their own wacky extensions, so it is impractical to deal with all those variants. We try to hit the common extensions, though.
If you just want to call C code, you don't have to translate it. The D compiler recognizes C files and will run its very own internal C compiler (ImportC) to compile it. As a bonus, the C code can use data structures and call functions written in D! The compatibility goes both ways.
Re: Zig Libc
#177Earlier quoted context omitted.
D can import C files directly, and can do C-source to D-source translation. D can compile a project with a C and a D source file with: dmd foo.d bar.c ./foo
This is the smart choice You keep compatibility with C, can tap into its ecosystem, but you are no longer stuck with outdated tooling D gives you faster iteration, clearer diagnostics, and a generally smoother experience, even if it doesn't go as far as Rust in terms of safety I wish more languages would follow this strategy, ImportC is great, let's you port things one step at a time, if required/needed Let's be hone…
Not me, and not anyone else. Many D users have commented on how ImportC eliminates the tedium of interfacing to me.
And with D, you don't have to write .h interface files, either (although you can, but it turns out pretty much nobody bothers to).
Re: Zig Libc
#178Earlier quoted context omitted.
> I think OpenBSD actually does support static libc though. How does that work, with syscalls being unable to be called except from the system’s libc? I’d be a bit surprised if any binary’s embedded libc would support this model.
> How does that work, with syscalls being unable to be called except from the system’s libc? OpenBSD allows system calls being made from shared libraries whose names start with `libc.so.' and all static binaries, as long as they include an `openbsd.syscalls' section listing call sites.
Re: Zig Libc
#179Earlier quoted context omitted.
Their underlying point is that you're actually being very selective in which laws you want enforced. For starters, I doubt you've brayed as loudly for the prosecution of business owners who employ illegal migrants, as you are for the migrants themselves. (You certainly didn't mention illegal biz owners in this comment chain.) Likewise, the crimes ICE commits already exceed the crimes of those they're hunting, but you…
"Conservatism consists of exactly one proposition, to wit: There must be in-groups whom the law protects but does not bind, alongside out-groups whom the law binds but does not protect."
Re: Zig Libc
#180Earlier quoted context omitted.
I made a Zig agent skill yesterday if interested: https://github.com/rudedogg/zig-skills/ Claude getting the ArrayList API wrong every time was a major reason why It’s AI generated but should help. I need to test and review it more (noticed it mentions async which isn’t in 0.15.x :| )
Fighting fire with fire