Up to now, the most convincing reason is "it is to make the language 
simpler" mentioned by Ian.

Maybe Ian is right. I have seen the following code in golang src:

type hmap struct {
    *[2]*[]*bmap
}

Maybe sometimes, it is really hard to judge if two types have a same 
underlying representation.


On Saturday, August 27, 2016 at 11:28:39 PM UTC+8, T L wrote:
>
>
>
> On Saturday, August 27, 2016 at 10:33:45 PM UTC+8, amk...@gmail.com wrote:
>>
>> Look at this example code from 
>> https://talks.golang.org/2012/goforc/celsius.go and you'll know why.
>>
>> Although the underlying type of Celsius and Fahrenheit are the same - 
>> float32. 
>> There will be no meaning if the language allow you to convert these type to 
>> the underlying type float32. What's it mean for 0 = 273.15? (273.15K = 0
>> °C). 
>>
>
>> Also, even for the Age type, I may use it for a person's age, you may use 
>> it for a virus' age.  
>> The person may live 100 years, but some virus may live only several 
>> hours. Although the 
>> underlying type is int, what does it mean when you compare a person's age 
>> with a virus' age? 
>>
>> "A type determines the set of values and operations specific to values 
>> of that type." 
>> type Age is not the same as type int.
>>
>
> In this example, in fact, values of Celsius and Fahrenheit (including 
> float32) can be converted to other types.
>  
>
>>
>> Andrew
>>
>>>
>>>>>

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