Programming thread

  • Want to keep track of this thread?
    Accounts can bookmark posts, watch threads for updates, and jump back to where you stopped reading.
    Create account
Since that post, I did read most of that book and implemented a decent amount of the code. Some works without a hitch; some requires very serious modification to work as of now. I don't know whether you want to see that as a bug or an accidental feature but I wouldn't use AtBSwP as your only resource. I do want to say that the introduction contains one of the best justifications (i.e. the part about the record store) for learning how to program I've ever seen.
 
i honestly wonder what would be a solution to removing header files
Header files are terribly antiquated tbh
They aren't antiquated at all. The compiler for a statically typed language absolutely, positively needs to know what types of elements are in a struct, and how many and how wide are the variables passed to and returned by external functions. The most flexible way to communicate this information to the compiler is by having it in a header file. Almost any other design you might come up with to supply this information to the compiler, in the face of all the practical cases that we deal with, is going to be somehow inferior. And, yes, that includes tranny dependency managers.
 
They aren't antiquated at all. The compiler for a statically typed language absolutely, positively needs to know what types of elements are in a struct, and how many and how wide are the variables passed to and returned by external functions. The most flexible way to communicate this information to the compiler is by having it in a header file. Almost any other design you might come up with to supply this information to the compiler, in the face of all the practical cases that we deal with, is going to be somehow inferior. And, yes, that includes tranny dependency managers.
You don't need dependency managers for modules tho. Multi pass compiler is all you need.
 
You don't need dependency managers for modules tho. Multi pass compiler is all you need.
multipass.png

There's no multipass compiling your code to work with external dependencies that you don't have the source code for or that haven't even been implemented yet. But you can seduce the software to poop out a binary that will work with even eventual libraries, with just a smile and a glimpse of header.
 
Classes also add polymorphism and inheritance. Albeit inheritance is disliked nowadays, I think it has it's uses.
I don't consider either of these desirable, at least in the form C++ offers them in. When I use C structs, I use them in a way that more closely resembles type composition.

Also how headers solve the problem of namespaces? It's the opposite, there is no namespacing whatsoever. Whatever int foo() is declared in header1.h, if it is in header2.h it has to be the same function. Otherwise you will get linker errors.
Poor phrasing on my part. I meant that this issue can be significantly reduced with good design and effective use of such headers (ofc this requires people not to be retarded...), but I was absolutely not clear. Good catch.
 
Last edited:
My main beef with C++ classes is they're a "solution" to an already solved problem. C has structs for objects and the headers largely solve the problem of namespaces and scoping.
This statement is incredibly wrong. If you have two libraries with conflicting symbols and you try to use them together, you’re going to be in for a rough time. Headers will do nothing to save you.
Also, structs and classes serve completely different purposes. Classes exist mainly to encapsulate behavior, not data, and allow shared behavior via inheritance and polymorphism. Structs do neither of these things.

Sometimes I think about what a "C+" might look like, a theoretical improvement on C that isn't as massively overbuilt as C++. I think Go goes a long way towards this, if you take out the large runtime it needs. Short declarations and Pascal type notation are really nice to use, and some of the convenience stuff is really nice too. Being able to declare a variable within an if-conditional—I’m not sure why that hasn’t become standard in other languages. I think it would be especially useful in a more functional language, I’ve certainly pined for it a few times while experimenting with Lisp these past couple weeks, but I digress.

They aren't antiquated at all. The compiler for a statically typed language absolutely, positively needs to know what types of elements are in a struct, and how many and how wide are the variables passed to and returned by external functions. The most flexible way to communicate this information to the compiler is by having it in a header file. Almost any other design you might come up with to supply this information to the compiler, in the face of all the practical cases that we deal with, is going to be somehow inferior. And, yes, that includes tranny dependency managers.
Manually writing header files is a bit antiquated. If you have a language feature that tells the compiler which functions you want to expose in a library, there’s no reason it can’t put it all in a header and spit it out. I assume that’s essentially how languages like Go handle modules in the backend.
Afaik, Zig is different because it just compiles all the libraries you need directly into your program. Apparently this makes it possible to do some cool and funky compile-time reflection stuff. Idk, I’m not a Zigger.
 
They aren't antiquated at all. The compiler for a statically typed language absolutely, positively needs to know what types of elements are in a struct, and how many and how wide are the variables passed to and returned by external functions. The most flexible way to communicate this information to the compiler is by having it in a header file. Almost any other design you might come up with to supply this information to the compiler, in the face of all the practical cases that we deal with, is going to be somehow inferior. And, yes, that includes tranny dependency managers.
The antiquated part is doing it at the level of a textually included header file, where you need dumb shit like preprocessor include guards.

The ML languages have modules and module signatures that do a similar thing. They describe the public interface to a chunk of code, with the types that it operates on and the types of its functions/classes/etc. Except they're implemented at a higher level where the modules and module signatures are parsed as in-memory data structures.

I'm sure there's approaches where clever IDEs and compilers and whatnot can preprocess C/C++ headers and cache a lot of interesting information to cut down on compile time, but at the end of the day, to fully retain compatibility, they'll always still need to be able to execute or emulate executing the preprocessor nonsense.
 
They aren't antiquated at all. The compiler for a statically typed language absolutely, positively needs to know what types of elements are in a struct, and how many and how wide are the variables passed to and returned by external functions. The most flexible way to communicate this information to the compiler is by having it in a header file. Almost any other design you might come up with to supply this information to the compiler, in the face of all the practical cases that we deal with, is going to be somehow inferior. And, yes, that includes tranny dependency managers.
c++20 tried to solve the header situation with their new module system but it seems like devs largely don't like it and most are sticking with header files for now
 
Is anyone else here doing the advent of code? This year seems a bit underwhelming so far, for being only 12 days.
The last time I did Advent of Code was years ago but I have to wonder, with computing having the demographics that it does, what mah jiggas (Jewish niggas) are doing out there. Is Advent of Code just a Christmas ritual they have co-opted or can co-opt like Chinese restaurants being open on Christmas in NYC?
thorin-chinese-restaurant.png
 
[...]
>some guy makes rust, hopes it will compete with C
>another guy makes zig, hopes it will compete with C
>yet another guy makes odin, hopes it will compete with C

but before actually competing with C they first have to compete with each other for that "the new lang trying to compete with C" spot. [...]
Nulang hype is bullshit. It's clearly asinine to ask whether xyz was written in Rust before asking whether xyz was written well. And yet people do it.

If readability suffers while the task proves needlessly verbose and arduous, it easily turns out terrible in any language.

If something became the new C it would likely happen because it was engineered to be most practical, then safe on top of it. Historically it's the most expedient option that becomes lingua franca.

Languages are tools and are best used when expedient. Tools need to work reliably, not win popularity contests. The whole "competition" being had is pointless.

In short: I really wish people asked "Is it shit?" before asking "Is it Zig?"
 
Is anyone else here doing the advent of code? This year seems a bit underwhelming so far, for being only 12 days.
Agreed. The 7th day should presumably feel like a day 14 (maybe even later since it's a weekend puzzle) but it's closer to a day 8/9 on previous years IMO. Day 4 or 3 (can't remember which) in particular felt like it shouldn't even be an AoC puzzle

My guess is it's just the author adapting to the new 12-day format and he hasn't quite nailed the difficulty curve yet. Hopefully he improves it next year
 
VideoCardz: WebGPU is now supported by all major browsers - https://x.com/ChromiumDev/status/1995538384945664423

https://web.dev/blog/webgpu-supported-major-browsers (archive)

Browser and OS availability​

WebGPU is available on the following browsers and operating systems:
  • Chrome, Edge, and other Chromium-based browsers:
    • WebGPU is available on Windows (with Direct3D 12), macOS, and ChromeOS starting with Chrome and Edge version 113.
    • Support for Android was added in Chrome version 121 for devices running at least Android 12, and with Qualcomm/ARM GPUs.
    • Support for Linux and expanded support for existing platforms is in progress.
  • Firefox:
    • WebGPU is available on Windows as of Firefox 141.
    • WebGPU is available in macOS Tahoe 26 on ARM64 machines, as of Firefox 145.
    • Support for Linux, Android, and Intel-based Macs is in progress.
  • Safari:
    • WebGPU is available in macOS Tahoe 26, iOS 26, iPadOS 26, and visionOS 26.
For more details and updates on the availability of WebGPU as well as on the platforms where it is rolling out soon, see: WebGPU Implementation Status page.
 
Can't think of any reason why you'd be reading public mil-spec programming standards without either a) applying to a position at a contractor or b) actually needing to implement them for your job.
I am a bitter old man and therefor a naturally skeptical when some 26 year old chick does something this in-depth about something conventionally boring AF, even for tech-chicks. But there are always the exception.

This said, as a topic I have to admit its interesting, unique, and bait for the coomers for the ycombinator/reddit users by who is presenting it. But I cannot escape the notion she has tech-writers on staff with an entire studio behind it. I just wish she wouldn't drag everything out with filler and get to the effing point.
 
I am a bitter old man and therefor a naturally skeptical when some 26 year old chick does something this in-depth about something conventionally boring AF, even for tech-chicks. But there are always the exception.

This said, as a topic I have to admit its interesting, unique, and bait for the coomers for the ycombinator/reddit users by who is presenting it. But I cannot escape the notion she has tech-writers on staff with an entire studio behind it. I just wish she wouldn't drag everything out with filler and get to the effing point.
I don't know, she seems a lot more legit than Naomi Wu or Karlie Kloss
karlie-kloss-sucks-extended.jpg
 
Back
Top Bottom