286
you are viewing a single comment's thread
view the rest of the comments
[-] Valmond@lemmy.dbzer0.com 2 points 1 month ago

Header files are a thing of beauty! Languages that can't abstract away definitions suck (or are like script languages, which is fine for scripting).

[-] jjj 1 points 1 month ago

What do you mean by "abstract away", and what about it is exclusive to headers?

Eg most languages have something like a trait or interface wherein you can put a list of definitions (optionally with a default aka "inline" implementation) which are then actually implemented elsewhere. This is considered useful by everyone because it allows multiple implementations to be associated with 1 name. They are generally not desired in cases where only 1 implementation will ever be written.

AFAIK the only use case where headers accomplish the same is if they're treated as documentation for an API that could be implemented by any library.

Admittedly certain programming styles benefit immensely from headers, despite the drawbacks to "design as you go" programming.

[-] andicraft 1 points 1 month ago

definitions shouldn't be split into multiple places and i will die on this hill

[-] Valmond@lemmy.dbzer0.com 1 points 1 month ago

What do you mean? For me, a definition is declared once, in its entirety, and that's it.

Declaring it in several places makes no sense of course (for me at least) just include the header and voilà!

this post was submitted on 08 Jun 2026
286 points (100.0% liked)

Programmer Humor

32333 readers
704 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS