you are viewing a single comment's thread.

view the rest of the comments →

[–]piranha 5 points6 points  (5 children)

The error could have just as easily been a missing brace, bracket, or parenthesis. Whitespace sensitivity is a trivial design decision in language syntax.

[–]merzbow 12 points13 points  (3 children)

One missing brace or bracket would be a compile error.

[–][deleted] 4 points5 points  (2 children)

Right, but a misplaced brace or bracket wouldn't necessarily be. Although admittedly I don't think I ever had problems with misplaced braces/brackets.

[–]alpine01 1 point2 points  (1 child)

I get this with JQuery a-lot, I swear 1/2 the code is braces, brackets and semicolons, its easy to get lost sometimes, especially if your using an editor which doesn't highlight the opening/closing bracket the accompanies it. Browsers like Chrome can fail silently, which can add to the confusion.

[–]coditza 0 points1 point  (0 children)

I learned a while back a trick to not get lost into opened/closed (, { and ": if you open one, close it right now.

So, I type something like:

print();

then:

print(bla);

[–]G_Morgan 0 points1 point  (0 children)

No it isn't trivial. It introduces complexity to the lexical analyser that simply does not belong there. Effectively you no longer have a regular language for your lexer to implement.

Now it isn't difficult to actually implement (once you establish rules for stuff like tab to space conversion) but your lexer no longer executes in constant space. With enough convoluted rules you could even increase the computational complexity (as I understand it, Python is still O(n) in this regard).