On Saturday, August 27, 2016 at 12:28:16 PM UTC+8, Ian Lance Taylor wrote: > > On Fri, Aug 26, 2016 at 8:52 PM, T L <tapi...@gmail.com <javascript:>> > wrote: > > > > On Saturday, August 27, 2016 at 11:40:20 AM UTC+8, Ian Lance Taylor > wrote: > >> > >> On Fri, Aug 26, 2016 at 8:17 PM, T L <tapi...@gmail.com> wrote: > >> > > >> > On Saturday, August 27, 2016 at 9:06:00 AM UTC+8, mura wrote: > >> >> > >> >> Hi, > >> >> > >> >> Generally speaking, you may find it a bit of struggling if you are > >> >> trying > >> >> to write Go code in an attempt to emulate *how* other languages can > do, > >> >> or > >> >> to argue with the compiler about how a fresh learner would come to > >> >> think in > >> >> the first place. A tip for making the learning/adaption process > >> >> smoother is > >> >> to focus on *what* you want to achieve in the problem domain > (instead > >> >> of > >> >> language domain, like fighting the compiler). > >> >> > >> >> Veteran gophers would be most helpful if you ask about the specific > >> >> functionalities or features you are trying to build. It's very > likely > >> >> that > >> >> the language problems you encountered don't exist at all in other > >> >> well-explored approaches. > >> >> > >> > > >> > And it is very appreciated if you can show the behind reason for "why > >> > can't > >> > []Age be converted into []int". > >> > >> You have gotten several different answers to that question. > >> > >> What kind of answer would you find satisfactory? > > > > No one have answered what is the behind reason for "why can't []Age be > > converted into []int" yet. > > > > I don't think "rules disallow it, so it can't" is a good answer. > > Many people have answered it, including me. Perhaps you missed my > answer; it is here: > https://groups.google.com/d/msg/golang-nuts/jDcUu4gUIRc/fX5pI66zFQAJ . > > So, I'm sorry, but I have to ask again: what kind of answer would you > find satisfactory? > > Ian >
I have read and replied your answer above. And sorry I didn't convert all aspects in that reply. > "..., which makes it hard to understand what kind of answer you are looking for, and why you are asking. Can you expand on that? " Sorry, secret now. :) Alternative answer: I'm curious on the details of Golang rules. > "You are suggesting that there is an extra rule to forbids converting []T1 to []T2 when T1 and T2 have the same underlying representation." No. I understand []T1 can't be converted to []T2 when T1 and T2 have different underlying representation. Ok, the alternative of my question is: why []T2 and []T1 have different underlying representations when T2 and T1 have the same underlying representation? > "despite the overall prohibition on converting []T1 to []T2, you are permitted to convert them exactly when T1 and T2 have the same underlying representation. That rule is much more complex than the current rule. It means that people reading Go code have to understand when T1 and T2 have the same representation." So you mean there is no implementation obstacles to allow converting []Age to []int? The prohibition is just to make people less confused. But the current prohibition make me confused, may I am not a typical gopher. -- 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.