On Saturday, August 27, 2016 at 3:38:11 AM UTC+8, xiio...@gmail.com wrote:
>
> As an aside - there is a complication to this if this (original post) were 
> allowed/added to the language specification
>
>
> var (
> a  float32   = 1.0
> aa []float32 = []float32{1.0, 2.0, 3.0}
> )
>
> b := float64(a)       //is ok
> bb := ([]float64)(aa) //not ok
>
>
> If the second conversion bb was allowed it would require a lot of extra 
> magic work underneath -as a new slice would have to be created, large 
> enough to store float64s - not just a case of changing the slice header to 
> point at a new type.
>

I don't think so. I think changing the slice header is enough. Doing more 
is strange.
 

>
> So in reference to the original example - either extra code would have to 
> be added to do this work, or these cases of type conversion would have to 
> be dissallowed for slices.. Either way that's more compiler code, not less. 
>  
>

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