why ; ?

Pragma eric.t.anderton at gmail.com
Tue May 6 09:23:41 PDT 2008


Tomasz Sowinski Wrote:

> 
> Just another feature thought. Never gonna happen, but still...
> 
> What's the reason of having lines end with a semicolon? Anything else than a legacy issue with C/C++?
> 
> The only thing I can think of is having multiple statements in one line, but that only makes code unreadable. Wouldn't getting rid of ; improve readability?
> 

ECMAScript (JavaScript) allows this by making the terminating ';' optional,  but you wind up with occasionally hard-to-find ambiguities as a result.  You wind up falling back on using ';' everywhere as a habit just to avoid that problem.  Requiring it, on the other hand, means that this problem never comes up.

As as part of D's philosophy is to reduce to program errors by language design, removing ';' would be somewhat against that goal.  Even making it optional would be a bad move IMO.  So I think it's here to stay.



More information about the Digitalmars-d mailing list