326
submitted 2 days ago* (last edited 2 days ago) by HiddenLayer555@lemmy.ml to c/programmer_humor@programming.dev

Made with KolourPaint and screenshots from Kate (with the GitHub theme).

you are viewing a single comment's thread
view the rest of the comments
[-] tdawg@lemmy.world 23 points 2 days ago* (last edited 2 days ago)

Because sometimes that let can be replaced by other things like const. Which can be managed statically by the machine and not by my (imperfect) ability to know if it's mutated or not

[-] lobut@lemmy.ca 5 points 2 days ago

I think you can do const thing = ... as constto lock down the mutation?

[-] ZILtoid1991@lemmy.world 4 points 2 days ago

So is let in some languages. In Rust, you have to constantly opt out from immutability with let mut, which makes writing more procedural code feel like you're fighting with the compiler, and otherwise I don't really see the rationale behind full functional coding. I only had a bug caused only once by unwanted mutation, the hardest part fixing it was to learn the proper use of my debugger tool.

[-] Scoopta@programming.dev 1 points 2 days ago

Ok but, in the second example you typically just put final or const in front of the type to denote immutability. I still don't see the advantage to the first declaration.

[-] tdawg@lemmy.world 2 points 2 days ago

oh for sure, but I think that's the rarer case for language implementions. Having a consistent structure with alternative keywords in static positions is just easier to develop an AST for. Personally my favorite language doesn't even allow for const values (except by convention) so it's really just a matter of preference

[-] Scoopta@programming.dev 1 points 2 days ago

Is it rarer? I think a lot of modern languages go for the first option but pretty much all C style languages use the latter. It's probably a wash for which is more popular I'd think.

[-] tdawg@lemmy.world 1 points 2 days ago

I'm talking about quantity not the popularity of a given language. There are certainly a number of popular languages that follow that convention

this post was submitted on 19 Jun 2025
326 points (90.1% liked)

Programmer Humor

24374 readers
866 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 2 years ago
MODERATORS