> Quiz 2: Now, imagine that you are a nim newbie. Try to fix the errors with 
> the help of nim manual and compiler error messages. Or,better yet, ask a nim 
> beginner to fix the code and watch the frustration grow.

Or better yet, you ask a beginner who can read a tutorial again to look at some 
valid syntax. I'm not a fan of pathos.

> The errors in the code were not invented by hand, they are real mistakes I 
> admit I have made when learning to nim. Therefore I expect that other 
> beginners will make the same mistakes. The point is that the compiler error 
> messages for these examples are not only unhelpful, they are misleading - if 
> you blindly follow them, you'll end up with even more confusion.

A compiler is not some interactive programming language teacher. That's 
certainly where the future is heading, but currently that is not what a 
compiler is. The compiler's error messages are about pointing out errors. Not 
about guessing what the beginner might have meant instead. For example, in `[a: 
10, b: 10]` that is a valid array construction, but `a` is an undeclared 
identifier. The compiler doesn't look at the larger context to see that you use 
the wrong syntax for tuple creation.

Having said that, the compiler's error message are constantly improving. 
"Imagine somebody trying all sort of token permutations to create tuples" 
wasn't on my radar, but probably for the next version we can improve some of 
these error messages.

Reply via email to