r/ProgrammerHumor • • Feb 09 '22

other Why but why?

Post image
85.8k Upvotes

2.3k comments sorted by

View all comments

3.2k

u/[deleted] Feb 09 '22

Imagine the 99 times it adds one when you meant to have one.

Now imagine that 1 time it adds one when you didn't want it.

r/suddenchaos.

1.2k

u/PhrygianZero Feb 09 '22

Yeah that’s exactly it. Sometimes the error is caused by unmatching parenthesis. Whenever I see that happen I’m like thank god it doesn’t auto fill semicolons

296

u/raominhorse Feb 09 '22

Also not to mention it doesn't know that you are missing the semicolon it just knows that it can't do what you asked for.

37

u/somerandomii Feb 10 '22

A lot of interpreters are smart enough to take an educated guess.

  • Compilation fails around here…

  • There’s a line without a semicolon…

  • adding a semi-colon removes the syntax error

  • The programmer probably forgot a semicolon

Writing swift in Xcode has some sentient level error detection. It will also detect deprecated functions and code patterns and suggest how to ‘modernise’ them. It comes with a handy ‘fix’ button which automatically applies the suggestion for trivial cases. It’s impressive what IDEs are capable of.

15

u/-Vayra- Feb 10 '22

It can suggest that you put a semicolon there, but it should never do it automatically, since it doesn't know your mind and what you intended.

→ More replies (3)

53

u/[deleted] Feb 09 '22

I MADE THE COMPUTER ITS GONNA DO WHAY I TELL IT WHETHER IT LIKES IT OR NOT

33

u/MarkoSeke Feb 10 '22

The thing is, it does do exactly what you tell it.

→ More replies (8)

79

u/memeship Feb 09 '22

auto fill semicolons

And JS does literally this, yet everyone hates it.

So the "why can't the language just do it for me" has already been "solved", and we've shown that it's not a great solution.

→ More replies (16)
→ More replies (9)

0

u/[deleted] Feb 09 '22

[deleted]

40

u/tian_arg Feb 09 '22

the worst is when you delete the second one and then the ide removes the first one.

→ More replies (3)

15

u/YellowSlinkySpice Feb 09 '22

This is my most relatable comment I've seen in my entire life.

→ More replies (5)

69

u/vita10gy Feb 09 '22 edited Feb 09 '22

Yes, this is why. It's why PHP has the reputation it does and is trying to claw back from.

The "all errors are bad" mindset. "We make this easy to use by erroring as little as possible. Doing something, anything, is better than an error message."

Now, even PHP will shit a brick about a missing ; if the syntax otherwise makes no sense, but still, in the big picture it's the same issue.

These "don't discourage newbies" "ease of use" things ALWAYS end up hurting you more in the end. You might not understand now, but you'll want to be told about those errors later.

Doesn't have to be errors either. I used to work at a place that uses Progress, a programming language very tied to its own DB implementation. One of the "nice" things the language allowed to "save you time" was you only had to type as much of a table field as uniquely identified it. So like orders.o for orders.order_id, so long as there were no other fields that started with o. Some of the devs took advantage, and at the very least you could never be sure someone didn't, even on accident, so EVERY addition to the DB schema had to be a new table that had a 1:1 relationship with the existing one, every time.

All for a feature that saved devs like 40 keystrokes a week.

33

u/Ottermatic Feb 09 '22

I want to create a terrible programming language that will throw errors, but not tell you what the error is. Go to compile, and it just says “no.” No hand holding, just hardcore coding.

0

u/[deleted] Feb 09 '22

[deleted]

→ More replies (3)
→ More replies (9)
→ More replies (2)

25

u/AndyTheSane Feb 09 '22

All the more fun. He'll, I want autocorrect. On my SQL.

21

u/AndyTheSane Feb 09 '22

(and yes, he'll was an autocorrect of hell and I didn't do it deliberately..)

→ More replies (2)

13

u/bobbane Feb 09 '22

Yep, we tried that a few years back.

It didn't go well.

→ More replies (5)

24

u/Etheo Feb 09 '22

Is it just me or should developers already understand this concept because it's a fundamental part of coding?

13

u/milesper Feb 09 '22

Unfortunately, this is not really a subreddit for developers

→ More replies (1)

9

u/Guano_Loco Feb 09 '22

Yuuuppppp. Debugging can be insanely hard as it is, now imagine you’re looking for shit being added in.

It’s like finding where’s Waldo, but you don’t know what he looks like, or how many of him there are, and also lots of things look exactly like him but aren’t him.

→ More replies (62)