Hacker News new | ask | show | jobs
by jpeanuts 1526 days ago
A place where autocorrect might be considered is in REPLs. Out of habit I still regularly write "print 'a'" in the Python REPL although I've been using Python 3 for a while. You get:

SyntaxError: Missing parentheses in call to 'print'. Did you mean print("a")?

Well yes... obviously... so please just print it.

2 comments

That would mean adding a rule to the language. The rule of "you can use 'print' as an statement". A rule that, time after time, has been shot down.

Which leads us to the real issue at hand: if the compiler is going to do anything by itself, that means it is following well defined rules. Therefore, whatever automatic thing the compiled does is part of the language. And, sometimes, the design rules of said language plain and simply do not allow for that.

Be careful what you wish for. Parsers guessing at the authors intention is what gave us HTML.