My eyes has just been opened. Silly me, I get it now. Thank you very much. May I ask which section in the Language Specification <https://golang.org/ref/spec> mention this allowance of int (or float64, ... etc.) for use as identifier names?
On Saturday, August 12, 2017 at 1:30:04 AM UTC+7, Ian Lance Taylor wrote: > > On Fri, Aug 11, 2017 at 11:03 AM, Penguin Enormous > <[email protected] <javascript:>> wrote: > > > > I think that there is inconsistency in the way Go compiler report error > > regarding name/unnamed parameters. This is a bit hard for me to explain > in > > words so please check out this short snippet first: > > > > https://play.golang.org/p/Sg0DtCtgF2 > > > > Is this unexpected behavior or it's just me that's feeling strange? > > Go does not permit mixing named and unnamed parameters in a parameter > list. > > In a declaration like Run(int, f float64) you have two parameters of > type `float64`. The first parameter is named `int` and the second > parameter is named `f`. (The essential point here, of course, is that > in Go `int` is not a keyword, and it's OK, though weird, to have a > parameter or variable named `int`). > > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
