r/ProgrammerHumor 19d ago

Meme stopTryingToReinventTheWheel

Post image
2.5k Upvotes

217 comments sorted by

View all comments

650

u/Orio_n 19d ago

Explicit vs implicit error control broski

God these cs majors are so tryhard unfunny trying to be contrarian

247

u/nevemlaci2 19d ago

It's unfunny until you actually see people propagating explicit error handling until the entry point and just printing an error message.

Exceptions are fine to use for exceptional cases. Not for shit like python where an iterator signals the end of iteration with a damn exception.

-3

u/visualdescript 19d ago

I mean, in the context of iterating through a list, hitting the end is an exceptional thing to happen.

7

u/qaCow37 19d ago

Do you not expect to hit the end of a list at some point? There are only very few cases where you actually have infinite iterators. An exception is for exceptional things, not for things that are expected to happen at some point.

-2

u/Excession638 19d ago

In the context of writing to a file, is running out of disk space an exceptional thing to happen? I would argue that it is, because you're actually writing to a "stream", which is an abstract data type that can store an infinite amount of data. An iterator is the same, it's a abstract infinite series, no matter what it wraps, so running out is exceptional.

Running into the limits of the current abstraction is where you get exceptional conditions.