On Fri, Aug 26, 2016 at 10:51 AM, T L <tapir....@gmail.com> wrote:
>
> On Saturday, August 27, 2016 at 1:43:03 AM UTC+8, Axel Wagner wrote:
>>
>> The effort is putting a special case into the language for this.
>
>
> I feel the effort is made to forbid converting []Age into []int instead now.


What is your overall goal with all the questions you ask?  You seem to
have a certain point of view about the language, one that is not
shared by many other people who work with and on the language.  You
ask your questions in a very terse manner, which makes it hard to
understand what kind of answer you are looking for, and why you are
asking.

Can you expand on that?


To answer this specific question of yours, one in a long series, there
is one rule in the language: you can't convert []T1 to []T2.  You are
suggesting that there is an extra rule to forbids converting []T1 to
[]T2 when T1 and T2 have the same underlying representation.  Your
statement is clearly incorrect; there is no such rule.  Perhaps I
misunderstand what you are saying.  However, the only way I know to
interpret what appears to be your suggestion is to add a new rule to
the language: 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.  It means that
that needs to be defined in the language, which it currently is not.
For example, on a 64-bit system, should we permit converting []int to
[]int64, one on a 32-bit system should we permit converting []int to
[]int32?  These questions do not have obvious answers, at least not to
me.  The rule saying you can't convert []T1 to []T2 is very simple,
and can be understood by even a beginning Go programmer.

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