|
|
|
|
|
by burntsushi
3255 days ago
|
|
Your entire comment seems to be about C. But you asked about Go. C's type system is classically considered "weak" and Go's is considered "strong." This isn't controversial, insomuch as "weak" and "strong" have meaning in the first place. C will perform some implicit conversions between types for you. Go won't. That's the difference that causes one to be considered weak and another to be considered strong. Any two type systems can be meaningfully compared. My comparison was exceptionally broad and seems perfectly consistent with everything you said. |
|
I also deny that autoconversion weakens a type system. For example, if you have a data type which holds a person's height, it is utterly uninteresting what units it's in most of the time, and it can save a lot of trouble if the runtime or compiler keeps track and converts automatically if you try to add a height currently being stored as inches to one currently being stored as centimeters, or adding centimeters to fractional centimeters rounded to the nearest millimeter, for example. There are any number of purely mechanical autoconversion tasks which can and should be done automatically and which don't change the type, in that they don't change which operations are valid for the value. And that autoconversion still wouldn't make adding height to age any more sensible, even if the two values were truly indistinguishable at the machine code level.