r/ProgrammerHumor • • Sep 25 '26

Meme iHatedItUntilITriedIt

Post image
10k Upvotes

540 comments sorted by

857

u/enigma_0Z Sep 25 '26

Static typing makes the IDE work for you better.

Type hints in Python and TS do the same but make you work harder for it /IMO

416

u/DrMobius0 Sep 25 '26 • Heartwarming

Static typing turns so many runtime errors into compile errors. Makes life a lot easier when you don't have to hunt down where the wrong thing came from.

136

u/Zerschmetterding Sep 25 '26

And it's not like you can't actually cast types, it's just a conscious decision where you can add proper error handling.

→ More replies (6)
→ More replies (2)

178

u/zabby39103 Sep 25 '26

I'm convinced people who don't like explicit typing have never worked on a large project and seen the benefit it has, both in the IDE and also keeping slop under control.

University projects and hacking around are one thing. Projects with a team of developers that evolved over a decade need all the help they can get to fight against the relentless entropy and disorganization that occurs otherwise.

43

u/Weekly_Interview_936 Sep 25 '26

Same. When your "programming" experience is just writing some scripts so small they don't even require scrolling it's really easy to not run into the problems that are very common in any program of serious size and scale.

→ More replies (1)

18

u/DrMaxwellEdison Sep 25 '26

The team that's been working in the big legacy monolith for that decade isn't helping much here, unfortunately. They know the quirks of the system by heart, they don't know there even is a problem here, their own knowledge of the language stopped accepting pull requests (so to speak) when none of these new features existed, and they have neither the time nor inclination to learn.

Add in slop code that just mirrors the current style instead of attempting to upgrade it without specifically being told to do so, and what we get is shit copying shit and producing more shit that reinforces the shit.

→ More replies (2)
→ More replies (6)

14

u/SirThane Sep 25 '26

I still remember the joy of how PyCharm changed when I started typehinting everything. It change my habits forever.

→ More replies (2)
→ More replies (4)

990

u/GargantuanCake Sep 25 '26

Dynamic typing can seem great until you have to spend days trying to figure out where, exactly, in 20,000 lines of badly documented code JavaScript arbitrarily decided that something should be a string for the rest of forever even though it's only been given numbers to work with.

If you type x = 1 + '1' any sane language will go "what the fuck is wrong with you?"

199

u/ubus99 Sep 25 '26

That, and just learning a new library / API: I hate how in python you can never be sure what type you need to put in, are going to get back, and what all of the fields and functions do. Sure, you can dig that up, but that's not my job!

98

u/nullpotato Sep 25 '26

Me: always insist upon explicit type hints and multiple linters to verify them

Coworkers: who hurt you?

→ More replies (2)

18

u/New-Shine1674 Sep 25 '26

I especially hate how difficult it is in Python to find out what fields a type even has and what I can do with it. It just looks very cluttered to me but maybe that's just because I primarily use c#.

→ More replies (1)

25

u/Pan_TheCake_Man Sep 25 '26

Just make everything a string and append, boom done

10

u/SuperFLEB Sep 25 '26

Convert inputs to unary and there's no problem.

value_1 = "1".repeat(integer_input_1)
value_2 = "1".repeat(integer_input_2)
return length(integer_input_1 + integer_input_2)

16

u/EchoLocation8 Sep 25 '26

This exact thing caused a bug in my company's system. Went years without noticing it until someone (me) had to build something that did a calculation between the number of units of a product and its weight in grams. It was data we ingest constantly but, there's so much of it, and its not something we really interacted with until we wanted to build a feature around it like 5 years later.

Was real fun when the database data pipelines started breaking because it turns out multiplying two 86 digit numbers together is bigger than the size of an integer column. As soon as I saw it I knew where to look, the quantity was like 202020202019191918181520202020202020141299920202020 etc.

15

u/huuaaang Sep 25 '26

Just to be clear, Javascript is not just dynamically typed, but it is also WEAKLY typed. The latter is where most of its problems/quirks/headaches come from. Implicit type casting is just evil. Dynamic, but strong, typing will still surface errors, just at runtime and not compile time.

→ More replies (2)

27

u/D1firehail Sep 25 '26

Assuming x is an int C and C++ will give x=50. '1' is a char, which allows implicit conversion to int.

30

u/frogjg2003 Sep 25 '26

They said "sane" language. C was developed before something like this was considered insane.

→ More replies (7)
→ More replies (2)

9

u/enz_levik Sep 25 '26

Even python can do while stuff if you somehow sum different formats of floats

→ More replies (2)

4

u/Turbulent_File3904 Sep 26 '26

believe or not, but in c or c++ 1 + '1' = '2' 

→ More replies (1)

3

u/ApocalyptoSoldier2 Sep 25 '26

I'm fine with number + string being a string as long as you can only assign it to a string variable

→ More replies (1)

3

u/TheLayeredMind Sep 26 '26

With static typing you get scary compile errors. With dynamic typing you get even scarier runtime errors 😂👋

→ More replies (34)

1.1k

u/Common-Brush-7027 Sep 25 '26

I hate dynamic typed

334

u/elmanoucko Sep 25 '26 • Popcorn

I type dynamic hate

59

u/Esjs Sep 25 '26

Hate dynamic type I

→ More replies (6)

85

u/coffee_warden Sep 25 '26 • Bravo

Friggin vibe typers

49

u/G3nghisKang Sep 25 '26

"Vibe typer" sounds like a Java programmer who declares everything as Object

→ More replies (7)

11

u/M4mb0 Sep 25 '26

Most of it wouldn't be needed if languages had powerful enough type systems. But few general purpose mainstream languages offer dependent types or higher order types. Apart from Haskell, what do you have? Only Scala and TypeScript come to mind.

And that's where dynamically typed languages come in, they let you express things that many statically typed languages simply can't due to limitations of the type system.

That being said, portions of the code that can be statically typed, should be statically typed.

→ More replies (2)
→ More replies (6)

225

u/semioticmadness Sep 25 '26

I’m very anchored to Java. Every time I try to leave it and “write a super quick project” in something like Python, I always get reminded how much the compiler is able to do for me with static typing.

Why would I want to take compiler errors and instead make them runtime logic errors?

34

u/Syagrius Sep 25 '26

Java is the way.

39

u/SubArcticTundra Sep 25 '26

Have you tried Kotlin? It's like Java but less verbose

53

u/Weekly_Interview_936 Sep 25 '26

With modern IDEs Java's "verbosity" is very much a meme. Sure, the characters are still there on the screen. But you didn't have to type them.

And honestly if typing is a problem for any programmer then they need to close hackernews and all the other "look at new shinies" sites and open up a typing trainer game.

→ More replies (11)
→ More replies (13)
→ More replies (6)

72

u/Erisymum Sep 25 '26

New programmers start with dynamic types now? We always started with C at my uni

25

u/Efficient_Maybe_1086 Sep 25 '26

C is so weakly typed might as well be dynamically typed

6

u/OKB-1 Sep 25 '26 edited Sep 26 '26

Some do. Really depends on the kind of university/program you pick. My first programming language was JavaScript, because my program was about communication and multimedia design (read: web development, graphic design and marketing). And I heard that on some economics programs they teach students Python and/or R. In other words: you don't have to do a computer science program to get taught programming.

→ More replies (5)

38

u/Masterflitzer Sep 25 '26

implicit types are great as long as the language is statically & strongly typed

32

u/DontDoodleTheNoodle Sep 25 '26

I learned with Java, so explicit typing was my bread and butter (and still is)

Que my absolute “what the fuck….” when I was handed a JavaScript + python project for the first time. Languages favored by the utterly deranged.

23

u/TheShirou97 Sep 25 '26

Static typing with type inference >>>>

→ More replies (3)

28

u/Local_Surround8686 Sep 25 '26

I didn't even know there was an alternative. We got taught explicit in school and I always thought the alternative was a quirk of some languages haha

16

u/Tsu_Dho_Namh Sep 25 '26

Same

Might be that most self-taught beginners start with either Python or JavaScript. Whereas in school they start us with Racket and C

11

u/Devatator_ Sep 25 '26

I always wanna cry when I see people recommend Python as a first language. Hell, even when I got started myself I used C#. In college we started with a bit of C. We only did python and JS the second and third years lmao

→ More replies (7)
→ More replies (4)

61

u/aberroco Sep 25 '26

Wait till you try static nullability checks.

18

u/andrerav Sep 25 '26

Stop, their poor TDD brainwashed brains can only take so much at a time

10

u/fghjconner Sep 25 '26

Or better yet, just removing implicit nullability.

6

u/aberroco Sep 25 '26

That's what I meant. Not much use of static nullability analysis without removing implicit nullability.

→ More replies (3)

13

u/FriendshipProtocol Sep 26 '26

Yup. It makes the code so much easier to review/debug.

43

u/SaveMyBags Sep 25 '26

Wait till you learn we can have both. Strong typing without having to name them all. It's called type inference and it's only been around for a few decades.

TBH: it's nice to see mainstream catching on to how important types are in general and how they can prevent bugs. People will get there eventually.

→ More replies (7)

126

u/samanime Sep 25 '26

You'll pry my vanilla JS from my cold dead fingers. It'll always be my favorite way to do quick scripts and prototyping.

But explicit typing does make long term code way more maintainable.

35

u/Hohenheim_of_Shadow Sep 25 '26

There is room for quick hacky small BS in the world. As a C++ dev who never touches Javascr*pt, Typescript is the true evil IMO because it encourages making huge projects in a fundamentally hacky language.

If your JavaScript project has grown to the size static typing is a genuine aid, stop writing JavaScript!

Love me some Python when I just need 100 lines to parse some csvs

13

u/Fibrechips Sep 25 '26

But then how can we use our frontend developers on the full stack? We're simply trying to not pay bAcKeNd DevEloPeRs those pesky "salaries" they keep begging for.

9

u/GRex2595 Sep 25 '26

I don't really want to build a website in Java. APIs in Java, sure. Building a serious, dynamic site in Java with server-side rendering just sounds like a nightmare compared to using Angular. I'll even accept React, which I don't use because I haven't learned it.

Replacing desktop applications with electron and making them web clients, though, that was a mistake.

→ More replies (3)
→ More replies (1)

31

u/2eanimation Sep 25 '26

I love the syntax, but JS has one too many quirks for my taste.

if ([]) {
console.log("Ok, I guess")
}

if([] == false) {
console.log("Well this is awkward")
}

if ([] + []) {
console.log("You think this would print, don't you?")
}

16

u/MuchWalrus Sep 25 '26

Why would you type any of those things (aside from maybe the first one)

→ More replies (6)

14

u/Ozymandias_IV Sep 25 '26

Genuinely who cares. You never do that in prod.

→ More replies (9)
→ More replies (19)
→ More replies (6)

11

u/DasGaufre Sep 25 '26

It's great when you get an undocumented python code base, and the key logic function takes a variable just called "context". What variables and functions does it have? No one knows.

Having to follow the spaghetti to find where it even originated is so god damned annoying.

Oh but when I write it, no problem. Makes perfect sense. 

10

u/Donut Sep 25 '26

Imagine what it is like going in the opposite direction.

"WHAT IS THIS VARIABLE EVEN HOLDING????"

33

u/iamdestroyerofworlds Sep 25 '26

Learning Rust was and still is pure balm for my soul.

10

u/LeekingMemory28 Sep 25 '26

I’ll take compile time enforcement over 2AM runtime headaches.

Rust was the cold shower I needed to rethink architecture, data types, and memory management as well.

→ More replies (5)

8

u/Vyrnin Sep 25 '26 edited Sep 26 '26

That's the one thing about Lua that I didn't like. It feels wrong to just declare a variable and let it fly. It's like driving without a seatbelt. I can't be held responsible for whatever happens to that guy!

15

u/JackReedTheSyndie Sep 26 '26

It’s just so good that I question why there are dynamic typing in the first place, it only added confusion.

11

u/Keebster101 Sep 25 '26

Literally did this with my current project. Never used type hints in Python before, during uni it was a blessing being able to just do whatever with whatever because all that really matters is that the code worked, but now I've used them once I will bring it up in every future project

21

u/X-lem Sep 25 '26

I first learned explicit typed. Later I learned about JS and thought, "what is this monstrosity." Many years later I still don't understand why anyone would want dynamic typing.

8

u/razzemmatazz Sep 25 '26

Something something, lack of compiler, baby's first hello world. Idk man, JS is a special hell for those of us that like it. 

→ More replies (1)

7

u/FRleo_85 Sep 25 '26

you can have smart dynamic typing like python where 1 + "1" throw an exception because you're adding object of different type and Js dynamic typing where you can substract an array with a toyota yaris and get a result

→ More replies (6)

2

u/Mountain-Ox Sep 26 '26

Man, I started in JS/PHP. There's so much cult-like devotion to the languages. The only valid argument is that it reduces the iteration time because you don't have to wait for a compile. I don't know about Java, but I use Go now and the compilation step is about 1-2 seconds.

The idea that prototyping is faster in loosely typed languages is a total myth. I can build much faster when I know the type. And AI kind of broke everything, so it's better to have the compilation step.

5

u/Knighthawk_2511 Sep 26 '26

Imagine dynamic types being so hellish , an entirely new language was created just to add types ( I don't use either of scripts)

9

u/[deleted] Sep 26 '26

The classic programmer arc: hate types at 20, defend them at 30. Explicit declarations are documentation the compiler actually checks.

8

u/Karisa_Marisame Sep 26 '26

As a compiler dev whose company wants our stuff have a Python frontend because users use python… this hits too close to home

5

u/Magihike Sep 26 '26

Add a dash of mypy precommit hooks and CICD checks and you're golden.   We do almost entirely python and 99% of it is type-annotated and type-checked.

2

u/generateduser29128 Sep 26 '26

Next step they expect type hinting because otherwise it's hard to use 🤦

4

u/Fidodo Sep 26 '26

IMO, dynamic typing was an over reaction to C's tedium and Java's verbosity.

9

u/scheimong Sep 25 '26

You're on track towards haskell

14

u/achilliesFriend Sep 25 '26

Joke where?

3

u/ZunoJ Sep 26 '26

Strating with a dynamic typed language is a huge mistake

3

u/SE_prof Sep 26 '26

As an SE professor, this thread has made me so happy!

3

u/xubaso Sep 26 '26

Fine until nested generic type definitions can't be shown on a single monitor anymore.

3

u/robertshuxley Sep 26 '26

except if it's too type anal like old school Java. Typescript and c# do it better

3

u/jacob_ewing Sep 26 '26

Having done C in my youth and now doing JavaScript feels like regression.

13

u/Dmayak Sep 25 '26

I am using typescript almost exclusively now and I still think a few type errors occasionally are not worth the effort of writing down types for everything.

16

u/patient-palanquin Sep 25 '26

It's not just errors, wait until you're working on bigger projects where you're constantly passing around large objects (eg from the DB). The IDE can tell you exactly what fields are available and what they are.

→ More replies (8)

7

u/Aggressive-Share-363 Sep 25 '26

Thats because typescript kinda sucks because it has to cope with being Javascript (i.e. a language without typing). Languages built with types in mind from the start tend to work a lot better and be cleaner.

→ More replies (2)

7

u/earlobe7 Sep 26 '26

To me the trade off is:
Do you wanna spend the extra effort in explicitly writing down your types?
Or would you prefer to spend it in fixing the class of bugs caused by you having lost track of the exact shape of your data.

3

u/ConfusingVacum Sep 26 '26 edited Sep 26 '26

Exactly, you described it perfectly. For me JS vs TS is not even a debate. If you lean towards JS, you clearly didn't spend enough time debugging both.

→ More replies (1)

4

u/k_dubious Sep 25 '26

Types aren’t just there to prevent you from writing bugs in your own code; they’re also there to prevent other people who work with it from writing bugs in theirs.

→ More replies (7)

4

u/grandalfxx Sep 25 '26

Unless its typescript. We all just pretend to like type script

3

u/Harabeck Sep 25 '26

I mean, it can help, but I've also seen it miss type problems. It's just a bandaid. I really wish we could move past Javascript.

→ More replies (2)

2

u/Ok-Panda-178 Sep 25 '26

Explicit type enforced code
Me: any

2

u/kelpyb1 Sep 25 '26

It’s horrible until you get out of school and start working on projects that are more than just a homework script and you realize just how much organization and tooling reliant on explicit typing helps.

2

u/FrigoCoder Sep 25 '26

Anyone who advocates for dynamic typing deserves to refactor a humongous codebase.

2

u/ThePhyseter Sep 26 '26

I started on C# and loved explicit types. Then I got to Python and I started loving the wild freedom. The thing that actually surprised me is, after learning Php, perl, and javascript, when i go back to python what I find missing is the explicit declaration. "Let x" or "my x" or whatever to indicate you are creating a new variable here, in this scope, not mistyping the name of another variable you already created 

2

u/o0Meh0o Sep 26 '26

that's it. i'm leaving.

2

u/Safebox Sep 26 '26

I love it most of the time, but if I'm working on a small program I just want done quickly then suddenly typing is the one thing the compiler contains about.

2

u/Luna-Hazuki2006 Sep 26 '26

Literally me

2

u/def-pri-pub Sep 27 '26

This seems to be discovered by everyone at some point. Weak typing is a great tool (e.g. Python), but should never be trusted to newer programmers. Force them to use a strongly typed language and then later on (when they understand types) they can use weaker typed languages.

I used to tutor a lot of CS101 people where the class was taught in Python. It caused a lot of confusion.

3

u/MocknozzieRiver Sep 25 '26

Maybe I have a pigeon brain, but something about knowing exactly what the type is is just... Orgasmic. One fewer thing to try to remember in my pigeon brain

→ More replies (1)

3

u/OVectorX Sep 25 '26

when I was Junior, my lead dev first thing he told me, Do Not Use Var ever, its good but you will pul your hair figuring out what the variable is

8 years later, I never ever used in any of projects I shipped and cant be more thankful for such advice

3

u/marcodave Sep 25 '26

Lol we are really going in circles. Some 10-15ish years ago when probably most of the users here were barely able to write, dynamic typed languages were ALL the rage. JAVASCRIPT! I DON'T NEED TO USE TYPES BECAUSE I CAN JUST PASS A STRING, A NUMBER, AN OBJECT, A FRIGGING FUNCTION to the same parameter and I EXPECT IT TO WORK NO MATTER WHAT!

PYTHON ! DUCK TYPING ! THE TYPE WILL BE OBVIOUS FROM THE PARAMETER NAME, ARE YOU STUPID? VARIABLE ARGUMENTS! KEYWORD ARGUMENTS! YOU JUST NEED A COUPLE OF EXAMPLE CODE, WHO NEEDS OVERLOADED FUNCTIONS?

Java? The language of AbstractSingletonBeanFactoryVisitorBean ? Who needs that?

4

u/stlcdr Sep 25 '26

So being lazy and ignorant isn’t a good thing? Who’d a thunk it?

→ More replies (1)

4

u/ReasonableNet444 Sep 25 '26

God I hate programming "humor"

11

u/Nightmoon26 Sep 25 '26

You may be in the wrong subreddit, friend...

→ More replies (1)

1

u/Streakflash Sep 25 '26

python at its core

1

u/Anthonyg5005 Sep 25 '26

Haven't seen a chicken thoughts template used in over 5 years

1

u/mojur Sep 25 '26

Poly wants a cracker

1

u/QuackersTheSquishy Sep 25 '26

Learning SQL and Python for college, and started C# on my own. Loving static language

1

u/Mateorabi Sep 25 '26

Vhdl > verlog. At least systemveeilog gas the option to be pedantic 

1

u/Luneriazz Sep 25 '26

The moment you touch data model. type is your friend

1

u/Afraid-Locksmith6566 Sep 25 '26

one thing is i think even better implicit type deduction like hindley milner and simmilar, ao you write code and compiler, lsp and you know exactly what type things are. give f# a shot, or ocaml, or haskell. the thing when you write a function and the compiler know exactly what you want this is good stuff.

1

u/vastle12 Sep 25 '26

I learned on strictly typed languages, dynamic typing has been a necessary evil to me

1

u/BoredOY Sep 25 '26

Your first language should never be dynamically typed. Teaches way too many bad habits.

1

u/Crumineras Sep 25 '26

Var is real until literally anyone has to go through the code and figure out what it is doing. It’s not the biggest thing, but knowing what type the original author was trying to return/use is at least one more clue

1

u/shiny0metal0ass Sep 25 '26

Said all JavaScript devs ever

1

u/Zealousideal-Deer101 Sep 25 '26

I can't program for my life without telling the piece of shit variable what type it is
I try loosely typed languages, we are just not compatible. It doesn't work

1

u/comtrends123 Sep 25 '26

I thought world war II means World war 11?

1

u/StephenRoylance Sep 25 '26

explicit type declaration is a huge pain. but you know what's worse?

FINDING A STRING IN YOUR NUMBER AT RUNTIME

1

u/aleopardstail Sep 25 '26

not just explicit type declaration, but also a naming convention that indicates intended usage

1

u/undeadpickels Sep 25 '26

Oh look it's me a while ago.

1

u/SuperCarla74 Sep 25 '26

Pretty much why Typescript exists, and the name begins with *type*.

1

u/DarthCloakedGuy Sep 25 '26

I tried it... still not sure what the benefit is, and for some things it is very much not wanted

5

u/leavemealone_lol Sep 25 '26

If you build anything that spans over 1000 lines of code, you’d be grateful to instantly recognize the type of a variable.

→ More replies (1)

3

u/HiCookieJack Sep 25 '26

for me it became worth it when working with multiple people and that my IDE stops guessing what methods exist.

→ More replies (5)
→ More replies (1)

-14

u/Old-Attention-3936 Sep 25 '26

It's not hard to be consistent with what you store in variables

20

u/Tough_Condition4021 Sep 25 '26

"Just don't write bugs"

5

u/TheBlckbird Sep 25 '26

Thank you so much! This is the solution to all my problems. I am finally able to write bug-free code. Yaay!

→ More replies (4)

15

u/Emptronic Sep 25 '26

Types do much more than that fella

14

u/AndyTheSane Sep 25 '26

It's not hard to be consistent for a small personal project.

Now, for an enterprise level code base with millions of lines written by many people over years it quickly becomes very hard indeed..

Plus, when I'm coding, if I make a mistake or ambiguity I want the IDE or compiler to spit it back at me ASAP. I do not want that reaching runtime.

33

u/Merry-Lane Sep 25 '26

Totally, which is why Typescript didn’t overtake 90% of the JS projects in the 5 first years of its existence…

Oh, wait…

5

u/eightslipsandagully Sep 25 '26

JS is a special beast

→ More replies (11)

6

u/-Redstoneboi- Sep 25 '26

you know what is hard? having complete and clear documentation for what variables you expect for every function in a library

5

u/coinselec Sep 25 '26

What I hated most about reading python at work is that I have to often hunt what is the type assigned or returned or whatever. Maybe it's a skill issue. I also hate when people abuse 'auto' in cpp. Great they saved 5s of their time and waste 1minute of mine.

4

u/lOo_ol Sep 25 '26

Dude's that bird at the beginning of the meme.

3

u/SunCantMeltWaxWings Sep 25 '26

The hard part is when you read other people’s code and you don’t know what they consider “consistent”.

2

u/avdpos Sep 25 '26

...if you have a small program...
there are times explicit writing is good. Any many times it is really bad. Especially if your program lives for generations of programmers.

...living with a language that doesn´t have strong typing at all...

→ More replies (14)

0

u/Motleypuss Sep 25 '26

I'm of the mind that a decent programmer can track his own typing. I'm 47, and haven't been tricked into complacency yet. As I'm fond of saying, everything's just bytes, and it's good to have as much control over those bytes as possible.

3

u/ApocalyptoSoldier2 Sep 25 '26

But can you track someone else's typing?

1.8k

u/[deleted] Sep 25 '26

[removed] — view removed comment

9

u/SuperFLEB Sep 25 '26

Old Javascript bugs: When dynamic typing meets implicit cross-file global scope, shit gets weird.

→ More replies (2)

2

u/not_a_moogle Sep 25 '26

Debugger old vb code with typecasting off. Was passing in a string zero, but then doing an if statement to check it was an int 0.

Clearly code was not tested since the if block would not be executed. And it doesnt throw a runtime error.

2

u/escargotBleu Sep 25 '26

There could be error at 2 am, but I won't care before 8-9am anyway

4

u/lana_silver Sep 25 '26 edited Sep 26 '26

In 11 years of programming with only lua at work, I have seen one type-related bug in production, and that one involved a pretty gnarly array[1] vs array["1"] bug due to a sandbox env running code snippets loaded at run-time. Point being: While a type error, I'm not sure you could design a statically typed system with similar capabilities that would have caught it, but I'm not completely certain either way. It's also a very specific lua weirdness in that x[1] vs x["1"] is both legal code but distinct, and if anything, I think that was more the issue than the actual types.

That was the only bug involving classic stupid type mistakes on production. I have seen many type related bugs in C++ because int isn't uint isn't int8 isn't uint16 isn't float isn't double and yet they all silently convert to one another. In a dynamic language like lua you only get "number" and that really solves this issue.

Type-related bugs happen in development, not production, because you can always find them all during testing. If you manage to push a build that fucks up adding a string and a number, you clearly had zero tests for that, because it doesn't matter which number and which string you try to add so you fail. It's not an edge case, and if you have one test which at some point executes the line of code that's wrong, you'll have a failing test due to crashing.

If static typing reduced bugs in shipped software, we would know by now. We know that QA and TTD help. We have no statistics that show that lua is more buggy than C#.

Here's a summary of my last 25 years in tech.

Or by someone way smarter than me: https://youtu.be/2V1FtfBDsLU?t=3965

662

u/[deleted] Sep 25 '26

[removed] — view removed comment

10

u/dudesweetman Sep 25 '26

This makes me think of python-juniors comparing strings as if they where enums. Pair this with having to explain in a polite and professional manner why this is bad, meanwhile "do we really need code-review?".

I need a beer.

→ More replies (1)

5

u/MatsRivel Sep 25 '26

Rather that than someone passing "0"== True == 1, and thus ending up with the exact opposite of what you wanted without knowing it.

4

u/MoarVespenegas Sep 25 '26

I spent hours trying to debug some code where a property kept being null when it turns out it was referenced as both color and colour.
Never have to deal with that sort of bullshit with statically typed languages.

11

u/dronz3r Sep 25 '26

Good old days, AI kills the joy of spending all nighter to dig and find the bugs.

2

u/visor841 Sep 25 '26

Or instead of false, "false" which is true.

282

u/[deleted] Sep 25 '26

[removed] — view removed comment

95

u/rob132 Sep 25 '26

" Go to college " they said. " You don't want to grow up to be a garbage man" They said.

Garbage men don't have to worry about if the garbage that throwing away is actually garbage.

23

u/tewiti1108 Sep 25 '26

Both of them need to worry about overflows though. And one is much worse than the other.

9

u/xtreampb Sep 25 '26

They both have to deal with garbage collection.

48

u/stillalone Sep 25 '26

What about "00"?  Or "-0" or "+0" or "0x0"?

81

u/joonty Sep 25 '26

0x0 is the face I make when being forced to write PHP

4

u/xorbe Sep 25 '26

Don't forget "±0.0"!

→ More replies (2)

11

u/Crimento Sep 25 '26

Same with strict comparison in PHP. I once had a bug that existed only with a single user of the app. The first user.

Because $userId == false will still fire with userId 0.

I'm glad a decade went through and now an LLM can make the same mistake for me instead

7

u/anomalous_cowherd Sep 25 '26

I once spent two months applying a new-fangled static code analyser to a mature Java/C++ based commercial product.

It was incredible the things it found, many of which absolutely shouldn't even have compiled. Others were super subtle like if statements with a semicolon after the condition, meaning the 'true' block was executed every time.

So many long-running bugs went away after that marathon cleanup. It was interesting whenever a test failed after a round of static code fixes to see how often the test was set up to pass only the wrong code and was failing now it was right.

→ More replies (1)
→ More replies (3)

12

u/Salanmander Sep 25 '26

Java: "False is false!"

7

u/petervaz Sep 25 '26

false is !true

→ More replies (4)
→ More replies (3)
→ More replies (3)

42

u/[deleted] Sep 25 '26

[removed] — view removed comment

50

u/creeper6530 Sep 25 '26

Type inference (auto keyword) is NOT dynamic typing.

12

u/nomenMei Sep 25 '26

And type hints aren't static typing. I don't think they are implying otherwise.

→ More replies (4)

10

u/Ulrich_de_Vries Sep 25 '26

Templates in C++ were always duck typed (sure, at compile time rather than runtime, but good luck understanding the error vomit when an instantiation failure happens somewhere 8 layers deep), but since C++20 concepts they can be less duck typed.

So in a way, they are moving more towards explicit typing.

Auto is generally just sugar for template parameters anyways when used for return or parameter types.

9

u/aMAYESingNATHAN Sep 25 '26

Are concepts really less duck typing? I view them more as just a way to formalise the requirements of the type to work in the template so that you get a better error rather than a template monstrosity.

Like it's basically saying "you must meet these conditions in order to be a duck", rather than leaving it to the programmer to work out in what way their type is not the right kind of duck.

3

u/Ulrich_de_Vries Sep 25 '26

It's still duck typing in the sense that if a type satisfies the concept the instantiation can still fail if the template code contains some implicit assumption about the type that isn't present in the concept.

But if the applied concepts/requires clauses are well thought out enough then it should be the case that it communicates intent towards the programmer sufficiently that you understand what sort of types does the template work with.

So in this sense I see quite a lot of similarities with static type annotations in Python which also will not prevent you from putting in the wrong types, but at least the reader won't have to guess what sort of things that function is supposed to work with, and language servers can give proper code intelligence (with that said my experience with clangd and concepts is not good, it will give me appropriate error reports at the use site but autocomplete is kinda wonky even if i am trying to access operations permitted by the concepts).

This is what I meant by "less duck typing".

→ More replies (1)
→ More replies (2)

1

u/conundorum Sep 26 '26

auto is either "implicit template" or "non-template, deduce from assignment", depending on the context. Parameters tend to be the former, and return type tends to be the latter (unless the return type is dependent on a function template).

1

u/No-Information-2571 Sep 28 '26

Because templates are templates and not generics. And even without traits, you'll get a compile-time error if you try to wire up incompatible types, or are simply, instead of something else breaking down during runtime.

But the most important part is that types remain immutable during runtime.

5

u/enigma_0Z Sep 25 '26

At a job where we regularly use both, one can only hope 👰 🤵

2

u/conundorum Sep 26 '26

auto is just the "I typed it on the right of the =, so I shouldn't need to type it on the left, too" keyword, more than anything else. Oh, and the "this needs to be a template, but the syntax doesn't let me use a template here" keyword.

It's essentially just an inline template, which means it's supposed to deduce the exact type on assignment, then statically type itself to match and never change again.

1

u/not_some_username Sep 25 '26

auto isn’t a type btw. It just tells the compiler I’m too lazy to write the type myself.

var in Python or JS are more like \*(void\*)

1

u/MrHyperion_ Sep 25 '26

The only good reason to use auto is for iterators or something that takes 80 characters to write out. And even then typedef is better.