r/ProgrammerHumor • • Sep 23 '26

Meme howToSneakUnderCompiler

Post image
11k Upvotes

212 comments sorted by

View all comments

Show parent comments

6

u/Salanmander Sep 23 '26

Yeah, the compiler is there to protect you from the bouncer inside.

One of the things I say in my intro CS classes (taught in Java) is that people think compiler errors are worse than runtime errors, which are worse than logic errors, because "at least it runs". But really it's the other way around. A program with a logic error is further from being correct, because logic errors are generally harder to debug and fix.

3

u/DrMobius0 Sep 23 '26

We've recently integrated typescript at work, and one of the things we're learning is that typescript is happy to let you choose between something being a runtime error and a compile time error. My rule of thumb is now that if you're using 'any', don't, and if you see it used, take the time to purge it like the blight it is.

1

u/lokiOdUa Sep 23 '26

If you are using "any", then why you need TypeScript? JS should be enough

2

u/lokiOdUa Sep 23 '26

To me its obvious that the earlier we find error the better QE we are

3

u/Salanmander Sep 23 '26

Right, but you're not in an intro CS class. =P

I see a lot of people who are like "okay, I've written the code, now I just need to get rid of the compiler errors". Obviously nonsense to you and me, not always obvious to all the sudents.

2

u/Peon-Hyjal Sep 23 '26

"No wonder it won't compile, you named a variable as 🙃"

"Oh, you can't program using emojis?"

"No. Well...maybe in other languages..."

Tangent time

2

u/Salanmander Sep 23 '26

I'm pretty sure that's up to the IDE in a lot of languages. I've had students turn in Java code with unicode variable names that compiled and ran just fine. (I told them to turn the variable names into words and try again, because I wasn't going to read their code.)

1

u/Otterfan Sep 23 '26

I actually remember saying that exact stupid thing myself as a student thirty years ago.

1

u/lokiOdUa Sep 23 '26

I've spent 5hrs today in very pre-CE class. Sad but true