Improving Compiler Error Messages
Walter Bright
newshound1 at digitalmars.com
Sun May 2 16:27:47 PDT 2010
bearophile wrote:
> Error messages in Python are OK. But the whole syntax of Python is designed
> around the idea of no semicolons.
I think there's a misunderstanding. The bit about semicolons in the article was
not about removing statement terminators, it was about the idea that a statement
termination can be inferred. For example:
import std.stdio struct S { ... }
The compiler can infer that a statement terminator belongs between stdio and
struct, so why should the programmer have to insert one?
What Python did was use a linefeed as the statement terminator rather than the
;. Python does not attempt to infer where they should go. The redundancy is
still there.
Javascript is fundamentally different in that it attempts to infer the statement
terminator.
So why does D have ; as a statement terminator? The simple answer is because D
is intended to have a low barrier for entry for C, C++, etc., programmers. The
familiar look & feel makes the new language less intimidating. A personal answer
is that I simply like it.
More information about the Digitalmars-d
mailing list