this post was submitted on 10 Sep 2025
558 points (98.1% liked)

Programmer Humor

26307 readers
1328 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] kubica@fedia.io 67 points 3 days ago (3 children)

Empty string used to be like my own version of null pointer.

[–] marcos@lemmy.world 47 points 3 days ago

Oh, you worked at Oracle by any chance?

[–] DScratch@sh.itjust.works 30 points 3 days ago (1 children)

Dark times…

Like -1 for an Int nil value.

[–] uranibaba@lemmy.world 9 points 3 days ago (3 children)

Which language can nil an int?

[–] Ephera@lemmy.ml 10 points 3 days ago (1 children)

Groovy will automatically convert integers into objects, as it sees fit. And one such case is when you assign null to an integer.

There's some more languages, which try to treat primitive types like objects, to make them more consistently usable. As I understand, nullability is a big part of the reason why it can't be solved with syntactic sugar, so presumably this would be possible in all those languages.
If I'm not mistaken, Ruby is another one of those languages.

[–] JackbyDev@programming.dev 3 points 3 days ago (1 children)

Groovy is pretty wild. It's like, honey, you need me to make this a BigInteger for you? I got you honey, don't even worry about it.

[–] Ephera@lemmy.ml 3 points 2 days ago (1 children)

Yeah, I kind of respect the stance, because it knows what it wants to be, but I also wrap number types into a separate data type to document that maybe you shouldn't multiply a port number by the wheel count and pass that into the temperature parameter, because I want more fine-grained typing, not one-size-fits-all.

[–] JackbyDev@programming.dev 2 points 2 days ago

I love the idea of "tiny types" like that and wish they were built into more languages.

[–] Jankatarch@lemmy.world 1 points 2 days ago

Probably some monad magic idk functional programming.

[–] Valmond@lemmy.world 4 points 3 days ago (1 children)
[–] Ephera@lemmy.ml 3 points 3 days ago (2 children)

I believe, that would mean that any 0 is equivalent to the null pointer, since the null pointer is just memory address 0...

[–] qqq@lemmy.world 4 points 3 days ago* (last edited 3 days ago)

Not exactly "memory address 0"; there be dragons there. https://c-faq.com/null/index.html

[–] Valmond@lemmy.world 1 points 3 days ago

In C that would make sense yes.

[–] baines@lemmy.cafe 11 points 3 days ago

easy there satan