On Thursday, March 8, 2018 at 11:49:18 AM UTC-5, Ian Lance Taylor wrote:
>
> On Thu, Mar 8, 2018 at 8:43 AM,  <di...@veryhaha.com <javascript:>> 
> wrote: 
> > 
> > There are two semicolon rules in Go spec: 
> > https://golang.org/ref/spec#Semicolons 
> > The first one states how a semicolon will be automatically inserted, 
> > however, the second one states how a semicolon can be omitted. 
> > Isn't more consistent to modify the second one to the following 
> description? 
> > 
> > To allow complex statements to occupy a single line, a semicolon may be 
> > inserted before a closing ")" or "}". 
>
> We would have to change a lot of the syntax productions.  For example 
>
> StructType    = "struct" "{" { FieldDecl ";" } "}" . 
>
> The rule as stated permits omitting the final ";" when the "}" follows 
> on the same line (if the "}" is on a different line, the ";" is 
> inserted automatically anyhow).  If we change to your version, we need 
> to rewrite the StructType production to not have a trailing ";", and 
> then rely on the new rule to permit adding one. 
>
>
Ok, get it.

But how about just change the second rule to the following instead.

To allow complex statements to occupy a single line, a semicolon may be 
optional before a closing ")" or "}".
Compilers will insert it back if it is absent.

 

> Ian 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to