On Sunday, August 28, 2016 at 12:56:37 AM UTC+8, Michael Jones wrote:
>
> TL, I have been confused by this thread, your similar questions, and in 
> fact, most of your emails—until now. 
>
>  
>
> When you write ‘Why can’t X’ as you often do, I have presumed that this 
> was a casual and imprecise form of expressing the question “what is the 
> reason why a different path was chosen.” Now, based on this, I see it 
> differently. I think you mean it literally. I imagine myself walking beside 
> you and you saying, “Why can’t trees be blue? Why can’t dogs have square 
> heads? Why can’t cars have windows in the tires? Why don’t cats and pigs 
> swim?” Which is to say, it seems that you are writing email as a way to 
> share a stream of consciousness that every aspect of reality—every choice, 
> decision, evolutionary outcome, taste, desire—could in fact be different in 
> some other place or time or circumstance.
>
>  
>
> Now that the question unfolds as “Why is it not possible that X” (as you 
> wrote from the start) then the answer to your emails is, “It is possible,” 
> possible as in, “in a different language, with a different goal, on a 
> hypothetical computer, if the most common programmer errors were not as 
> they are, etc.” In engineering, nearly everything is possible. Not all of 
> the possibilities are good, wise, or desirable though, so I think many here 
> thought these other attributes were implied as part of your question. I did 
> before but now do not.
>
>  
>
> In your spirit of “Why can’t” as in “prove that it is impossible” (of 
> course such proofs are impossible), I offer examples of the uncommon but 
> possible.
>
>  
>
>           
>
>  
>
> A different question, “Why is X disallowed in Go,” is actually much more 
> educational. The example below, that was given you by amkguo, is the 
> example that I thought of right at first—not about “why can’t bytes be 
> interchangeable” but “why are Types treated as separate species.” This is a 
> great topic. Because of huge human experience that mixing types by concept 
> (adding two kinds of temperature or mass) results in unfortunate outcomes 
> (many!) and similar experience in debugging as the result of many 
> languages, C and C++ among them, doing natural-seeming invisible coercion 
> between types. Type coercion in specific and invisible actions generally 
> are a trouble area in large-scale software development. This is why the Go 
> team (superstars with UNIX, C, major Gnu C/C++ implementation, Plan 9, 
> Inferno, and maybe more importantly, careful study of common software 
> development problems by 10,000+ programmers Google) disallowed it during 
> the design of Go and instead require explicit casts (as in “var a int = 3; 
> b := float64(a)”), why they treat Types as non-mixing species, and why the 
> affordances around this are very limited.
>
>  
>
> I gave a talk in Madrid about Go as a software engineering approach 
> assisted by a computer language. This seems a nice educational way to avoid 
> many of the “but C allows …” or “it should be technically possible to…” 
> confusions. 
>
>  
>
> Michael
>

I never deny the great work made by golang team. In fact, I'm a go lover.
I just want to understand the reason for some golang syntax rules. :)
 

>  
>
> *From: *<golan...@googlegroups.com <javascript:>> on behalf of T L <
> tapi...@gmail.com <javascript:>>
> *Date: *Saturday, August 27, 2016 at 8:28 AM
> *To: *golang-nuts <golan...@googlegroups.com <javascript:>>
> *Cc: *<tapi...@gmail.com <javascript:>>, <amk...@gmail.com <javascript:>>
> *Subject: *Re: [go-nuts] Re: Why can't convert []T to []T2 if T2 is a 
> copy definition of T?
>
>  
>
> 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.
>
>

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