On Fri, Aug 11, 2017 at 11:51 AM, Penguin Enormous
<kimkhanh...@gmail.com> wrote:
> 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 mention this allowance
> of int (or float64, ... etc.) for use as identifier names?

https://golang.org/ref/spec#Keywords
https://golang.org/ref/spec#Predeclared_identifiers

Ian



> 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
>> <kimkh...@gmail.com> 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 golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

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