Semicolons: mostly unnecessary?

Ary Borenszweig ary at esperanto.org.ar
Wed Oct 21 16:03:58 PDT 2009


BCS wrote:
> Hello bearophile,
> 
>>> opens up bizarre parsing corner cases,
>>> and makes error messages uglier.
>> I have yet to see a proof of this.
>>
> 
> Just off hand for parsing issues:
> 
> - it allows long code lines to be folded

If you don't have semicolons this is also true, for example

a = somefunc( first_param,
        second_param)
b = something_else

I can insert a line break there without confusing the parser because the 
parser is expecting the function call to end

> - it acts as a bug check on reformat:
> 
> origonal code
> 
> MyType t; // result of -t and opSub_r(int) are lvalues
> auto a = 5
> -t = 3
> 
> MyType t;
> auto a = 5     -t = 3   //reformat and forgot to add ';' Oops

Why would the formatter do that? The line break is acting as a 
semicolon, it won't remove it.



More information about the Digitalmars-d mailing list