4 ms·
So, mixed typed tuples was the idea, but Go doesn't support either of those things, so it ended up as a [][10]interface{} or some such. So for each item in the
by silisili 5y ago
So, mixed typed tuples was the idea, but Go doesn't support either of those things, so it ended up as a [][10]interface{} or some such. So for each item in the slice, type assert all 10 things inside the subarray. Luckily the comments had a key of expected types of each.
- riwsky 5y agoYour problem isn’t generics or any other language features; your problem is a lack of effective code review or technical leadership.
- rustc 5y agoThat would be exactly the thing generics are supposed to fix (except that Go doesn't have tuples yet, but at least you can define your own now and return a generic `Tuple[A, B]`). Regardless of that, returning a tuple of size 10, especially with different types, would almost always be a bad idea.