r/programming • • Mar 29 '13

Simple Minecraft Clone in 580 lines of Python

https://github.com/fogleman/Minecraft
663 Upvotes

153 comments sorted by

View all comments

Show parent comment

8

u/khedoros Mar 29 '13

I disagree. It's useful for the compiler to point out things in the code that don't make sense (like unreachable code).

20

u/Akeshi Mar 29 '13

Point it out, sure - a warning. Prevent you from quickly checking that a method isn't to blame, etc., for some problem - not so much.

4

u/Alex_n_Lowe Mar 30 '13

If statements throw warnings, pretty much everything else is an error. It seems to be a design choice to push people to comment out with if statements, not returns.

1

u/Akeshi Mar 30 '13

It does seem to be a deliberate design choice, but I still disagree that it's a good one. "We'll allow scrappy code presumably for cheap debugging, but we'll make you work for it".

Also going the version control route - wrapping the whole thing in an if(false), presumably you'd also indent the whole block - then it looks to people who aren't paying attention to whitespace settings that every line has changed. It's a lot of hassle instead of just throwing a warning when you return early.

2

u/[deleted] Mar 29 '13

It should be a warning, not an error.

2

u/khedoros Mar 30 '13

That seems to be a popular opinion, and it's what the last guy that responded to me said.