5 ms·
And variadic args to NewSet looks a bit nicer yet at the call site: https://go2goplay.golang.org/p/fTp3W9IwuVP https://go2goplay.golang.org/p/fTp3W9IwuVP
by bradfitz 6y ago
And variadic args to NewSet looks a bit nicer yet at the call site: https://go2goplay.golang.org/p/fTp3W9IwuVP https://go2goplay.golang.org/p/fTp3W9IwuVP
- parhamn 6y agoIs there a way to do this without losing range?
- coder543 6y agoThe proposal is, for better or worse, quite clear about not providing operator overloading or anything similar in the near future. You could always offer a method that returns a slice of unique elements, which could then be ranged over.
- djur 6y agoI don't think there's nearly as much of an appetite for operator overloading as there is for an iterator protocol for range. That isn't to say that the latter wouldn't have a lot to argue over (internal vs. external, etc.) but I think the general usefulness of such a thing would be widely accepted by the community once generics are a settled matter, while I doubt that will ever happen for operator overloading.