Re:Rust and Go
by dbaupp on Saturday November 08, 2014 @07:21PM
(#8578620)
The interesting code for this example is:
c := a + b
There's no indication from that line of code what a and b are, a type system that doesn't do implicit conversions will tell you "error: adding string and int" and so the programmer can address the problem (e.g. maybe they meant to parse an integer from the string `a`, maybe they meant to format the integer `b` into a string).
Using literals is not a useful comparison because there is no confusion about types in that case.
Re:Rust and Go
by zzzcpan on Saturday November 08, 2014 @09:19PM
(#8578855)
My bad, I thought it was obvious from having separate operator for concatenation that '+' operator also has only one intent. So in your case it will parse an integer from a string if operand is a string.
Using literals is not a useful comparison because there is no confusion about types in that case.