-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generics branch no longer works on go1.18rc1 #79
Comments
Going through playing with some changes, for some of the tests, it seems there is no workaround to enable what they're trying to do I've commented on the PR to flag that, as it seems odd to make this kind of code impossible to write Edit: opened it as a new issue on the go repo - golang/go#51257 |
For now, I've released here without the problematic methods, as a workaround: https://github.com/billinghamj/golang-set |
Hey thanks for the vote of confidence on the new changes as well as the bug report. PowerSet was added sometime back for completion sake but I will admit that I don’t think it’s used all that much. I have recently considered removing it because I couldn’t find a great solution that was generics compatible. Your investigation is appreciated and I’ll see what I can do in the coming days. |
No problem 🙂 I'm very happy to pitch in with anything if that'd be helpful too 👌 |
@deckarep Now that 1.18 is out, do you think you'd be interested in releasing the generics branch, perhaps with the 2 problematic methods removed? |
@billinghamj - sorry for the delay on this. I have finally got around to release a 2.0.0 tag using your changes to support the final release of Go 1.18. Big thanks for sorting out the bug around |
I found this while trying to make project calico's They both give type-safe methods 👍 but |
@deckarep btw, now that Go 1.20 is out, I think those methods could be added back :) I believe the issue was finally resolved by golang/go#56548, and that change went out in 1.20 |
I realise it is not intended for use at this point, but thought it might be useful to bring to your attention.
The generics branch works great on go1.18beta1 & go1.18beta2
But on go1.18rc1, it has these errors:
I think this is as a consequence of golang/go#50646 (reference)
I've had a good look at it, and made some adjustments which seem to resolve most of it. But I wasn't able to find a way to get
PowerSet
workingFor
Pop
:(Though this does require a change to the method signature - an alternative might be to introduce a new method and return the zero value on the old one, or to return a pointer)
Edit: For
CartesianProduct
, your intended code still seems to have the same problemFor
PowerSet
, the problem is that it won't allowSet[Set[T]]
(Set[T] does not implement comparable), and the interface cannot be declared as comparable (interface is (or embeds) comparable)Perhaps an alternative might be to return
[]Set[T]
(?)The text was updated successfully, but these errors were encountered: