3 ms·
Yeah, I totally understand why there's a place for uint8 and int64, but wonder why I have to write x := uint64(a)+b // b is uint64 and x also will be instead ju
by kornakiewicz 12y ago
Yeah, I totally understand why there's a place for uint8 and int64, but wonder why I have to write x := uint64(a)+b // b is uint64 and x also will be instead just x := a+b, because type of x is still clear and casting could be done invisibly.
But after rethinking the issue I agree with you that's good idea, just hadn't meet place for this in my pet projects.
- Sanddancer 12y agoThere, I think the question is what type is (a). We're starting to get into the philosophy of languages here, regarding how much of a push between implicit and explicit we want. Are we expecting variable a to be pushed up into uint64 size in the intermediary? or are we expecting (b) to be pushed down to (a)'s size before adding them together. To be honest, I personally prefer C#'s model, where one can define explicit and implicit conversions, and handle accordingly, but can see the merits of go's tack in guaranteeing obviousness, even if it means typing a bit extra.