On Sat, Aug 27, 2016 at 8:26 PM, T L <tapir....@gmail.com> wrote: > > On Sunday, August 28, 2016 at 11:00:53 AM UTC+8, Ian Lance Taylor wrote: >> >> On Sat, Aug 27, 2016 at 12:41 AM, T L <tapi...@gmail.com> wrote: >> > >> > I don't think an int64 value can be converted to an int value is for >> > they >> > have the same underlying type. >> > In fact, an int8 value can also be converted to an int value. >> > "Number values can be converted to values of other number types" is >> > totally >> > an exception for the conversion rule. >> > This has nothing related to the underlying types. >> >> I'm sorry, I don't understand the point you are making. >> >> Ian > > > isn't the basic conversion rule is two values with a same underlying type > can be converted to each other' type?
Yes, if by "same underlying type" you mean "identical underlying type". In the original question of why you can't convert []Age to []int, []Age and []int are not identical underlying types. > (another basic conversion rule is, if T implements interface I, the values > of T can be converted to values of I) Yes, that is true. > The underlying types of different numeric types are different. > Golang just makes an exception/convenience to make it is possible to convert > the values of these types to any of these types. > > And there is another exception, integer values can be converted to string, > this is one-direction conversion. Yes, there are two different kinds of conversions: ones that do not change the value, and ones that change the value. It is perhaps unfortunate that they use the same syntax. I asked a question earlier, but I don't think you ever answered it. It's an important question. The question is: what kind of answer would you find satisfactory? Right now you seem to repeat the question in different ways, and none of the answers seem to get anywhere. So I feel that we need to step back and understand what kind of answer you are looking for. 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.