this post was submitted on 30 Jan 2025
309 points (97.5% liked)

Programmer Humor

20265 readers
1788 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
 

Have to add that we work exclusively in strongly-typed languages. Kinda want to see how it plays out, but I can't help but argue with him, so I think I'll just go.

top 28 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 1 day ago

Did I hear a Rock and Stone?

[–] [email protected] 6 points 2 days ago (1 children)

What about the caller? IMO types are more helpful for the consumer of the code than the original developer.

[–] [email protected] 3 points 1 day ago

You don't have to worry about that if nobody uses your code. taps temple

[–] [email protected] 6 points 2 days ago* (last edited 2 days ago)

That guy in corporate is creepy as fuck. I think he’s a pedophile. He’s always saying “TIME TO GET BUSY MINORS!”

[–] [email protected] 44 points 3 days ago (1 children)
[–] [email protected] 22 points 3 days ago

Did you know that the type of a variable is determined by the frequency of plasma oscillations among the objects valence electrons?

[–] ulterno 22 points 2 days ago (1 children)

So, using void * for everything?

[–] [email protected] 4 points 1 day ago (1 children)

I worked as a subcontractor with a lead architect that used casting to void * as an only method of sending data. Argument to a function? Void *. Return value? Void *. Multithread pipe? Cast to a void *, no big deal. 80% of my job was investigating segfaults. 20% was heavy drinking to prevent suicidal thoughts.

[–] ulterno 3 points 1 day ago

I do mainly C and C++ and for a while, I had to check out some JS code...
I wouldn't want to take your place.

The only case I remember using a void* in is when passing a function as an argument for a callback, to an RTC peripheral. Even then, the function was returning a void.

[–] andioop 35 points 3 days ago (2 children)

What is this a screenshot of?

[–] [email protected] 54 points 3 days ago

Deep Rock Galactic, an awesome pve/coop game :)

[–] [email protected] 33 points 3 days ago* (last edited 3 days ago) (2 children)

The game "Deep Rock Galactic"

Space dwarves (solo or co-op) mining in procedurally generated caves while getting bugged by the local fauna.

There are a few different mission types, four unique classes and a vast weapon upgrade system to explore.

Also features the best (non-voip) communication system ever.

Highly recommend. Rock and Stone!

[–] [email protected] 2 points 1 day ago

Rock and roll and stone!

[–] [email protected] 5 points 2 days ago
[–] [email protected] 0 points 3 days ago (5 children)

I recently tried out Python. I had no idea it still doesn't have runtime enforced typing...

I didn't realize that PHP was decades ahead of it.

[–] [email protected] 20 points 2 days ago (1 children)

Python is dynamically strong typed, meaning you don't need to specify any types, but unlike JavaScript you can't just use a string where an int was expected. In that sense it's absolutely runtime enforced typing.

[–] [email protected] 8 points 2 days ago (2 children)

... and yet... it lacks clear and enforced type restrictions which help with clear code contracts. It's certainly better than Javascript but the lack of runtime enforced type checking can force defensive programming in an unnecessary manner.

Your statement isn't strict type checking. It's a restricted form of type coercion. Given how common this feature is in other languages it's weird that pythonistas feel so defensive when discussing the feature. I enjoy strict type checking, but that's my opinion - it makes it a poor choice for the sorts of projects I work on but if it's good for you then enjoy!

[–] [email protected] 2 points 1 day ago

it lacks clear and enforced type restrictions which help with clear code contracts

Not anymore! Gradual typing is supported by the core language and pyright is a fantastic incremental type checker that you can use both in your editor and in CI.

[–] wraithcoop 3 points 2 days ago

You said it's not runtime type checking but then switched to "strict type checking" - those aren't the same. Other person has it right, it has runtime type checking. The type checking happens when running your code. I don't think that's particularly useful, it's pretty much sugar on top of what would throw an error anyway.

[–] Pyro 24 points 3 days ago* (last edited 3 days ago) (2 children)

Python 3.x will never have static typing because that would break backwards compatibility.

However, typing hints have been Integrated into Python for a while, and you are heavily recommended to use them, so your IDE can enforce typing.

[–] [email protected] 2 points 1 day ago

Also have the option of selectively/strictly enforcing in CI, to get an experience & protections similar to "compile-time type checking"

[–] [email protected] 3 points 3 days ago (2 children)

Considering there is typing in the code why is there no switch to enable type checking at runtime? PHP does this with a per file declare(strict_types) - why would python be unable to have either a global or per file flag to enable checks?

[–] [email protected] 2 points 1 day ago* (last edited 1 day ago)

why is there no switch to enable type checking at runtime?

Have you got problems this would solve? I've done a lot of type annotated Python at scale and I can't think of an example.

Edit: given nobody in their right mind allows code that's not checker clean.

[–] Pyro 10 points 3 days ago (1 children)

Typing when you need it gives you more freedom over a toggle. You can choose to type some parts of the code while leaving other parts untyped.

For example, if I'm writing a quick and simple Python script I may forgo typing, but when iterating on it I'd go back and add the types I need.

[–] [email protected] 4 points 3 days ago

This isn't an issue, though. PHP has the same partial typing flexibility. There are ways to solve that issue and even typed PHP still allows union types including mixed which allows any types.

[–] [email protected] 7 points 2 days ago

i mean yeah it's a scripting language, what did you expect?

do you want bash to add typing as well?

[–] [email protected] 4 points 3 days ago

apparently it's a feature

[–] [email protected] 2 points 3 days ago

apparently it's a feature