News for hackers. Stuff that matters.
Re:Using Zig's translate-C to understand weird C code by matheusmoreira on Wednesday November 03, 2021 @07:34AM (#29093283)
Yeah. I think I'm so used to C by now that I just can't handle anything that doesn't look like C. It's like my brain just ignores text when it can't recognize the C code patterns.

Semantically Zig is really interesting though.

Re:Using Zig's translate-C to understand weird C code by skocznymroczny on Wednesday November 03, 2021 @09:45AM (#29094458)
I feel similar when it comes to non-OOP code. I don't like free functions and global variables just hanging there.
Re:Using Zig's translate-C to understand weird C code by kristoff_it on Wednesday November 03, 2021 @10:37AM (#29095246)
OOP might have helped popularize usage of the dot notation, but namespaces are a different thing.

Zig has no inheritance but everything is namespaced, including declaring functions inside struct definitions so that you can use them as if they were methods.

Re:Using Zig's translate-C to understand weird C code by matheusmoreira on Wednesday November 03, 2021 @10:07AM (#29094741)
Yeah, me neither. Names must belong to some namespace, it really bothers me when code starts binding common nouns in a global context. C lacks namespaces so I use prefixes instead. At least this solution doesn't screw up the ABI like in C++.

I hate global variables so much it's one of the reasons I got rid of libc. Freestanding C turned out to be a superior language just because it lacks all the libc cruft.

I ultimately dropped Ruby because of global state. It's such a wonderful language but it has one fatal flaw: lack of proper modules. The require method just executes Ruby source files, modifying the global state of the interpreter. It ceased to be a beautiful language once I realized this. Python's modules are superior, and the Javascript approach is the best one: just a normal function that returns a normal object containing exported data and functions. Javascript modules are c.ompletely reified.