On Thu, Sep 6, 2018 at 7:00 AM, Jonathan Amsterdam
<jbamster...@gmail.com> wrote:
> Consider
>
> type Int int
> var y int = Int(3)
>
> The spec says
>
> A value x is assignable to a variable of type T ("x is assignable to T") if
> one of the following conditions applies:
>
> x's type V and T have identical underlying types and at least one of V or T
> is not a defined type.
> [other conditions]
>
>
> Here, x's type V is Int, whose underlying type is int, so the underlying
> types are the same. And one of V and T (namely, T, which is int) is not a
> defined type.
>
>
> So the spec says the assignment should work. But the playground says
>
>
> cannot use Int(3) (type Int) as type int in assignment

`int` is a defined type.  See the bottom of the
https://golang.org/ref/spec#Numeric_types section.

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