Semicolons: mostly unnecessary?

BCS none at anon.com
Wed Oct 21 16:22:04 PDT 2009


Hello Ary,

> 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
> 

but in some cases this can't be checked. (or needs tons of lookahead)

>> - 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.
> 

I'm not talking about a formatting tool. I'm talking about a person.





More information about the Digitalmars-d mailing list