www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: why ; ?

reply Pragma <eric.t.anderton gmail.com> writes:
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.
May 06 2008
parent Tom <tom nospam.com> writes:
Pragma escribió:
 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.

I fully agree. -- Tom;
May 06 2008