Skip to content
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

Use generics from go 1.18 #147

Closed
GRbit opened this issue Mar 16, 2022 · 21 comments
Closed

Use generics from go 1.18 #147

GRbit opened this issue Mar 16, 2022 · 21 comments

Comments

@GRbit
Copy link

GRbit commented Mar 16, 2022

It's 1.18 now.
Are you planning update your code to use generics? It will improve speed dramatically.

I know that some of the functions can't be properly updated due to the fact that interfaces are more flexible than generics, but there are a lot of functions that could be updated. And because of https://pkg.go.dev/golang.org/x/exp/maps and https://pkg.go.dev/golang.org/x/exp/slices some functions aren't useful right now. So, there are a lot of work =)

Will you accept any pull requests with generics?

@thoas
Copy link
Owner

thoas commented Mar 17, 2022

@GRbit yes, I would accept PRs and I'm currently working on a v2 to use generics :)

@valiangspe
Copy link

Looking forward to this. Greatly appreciated

@andig
Copy link

andig commented Mar 22, 2022

I‘ve just gone through the exercise and replaced funk by generics, mainly /x/exp/slices, which proved for my uses straightforward. The main omission in Go regarding slices is missing Map/ Reduce/ Filter afaikt.

@metalrex100
Copy link

@thoas create please v2 branch so it became possible to contribute.

@thoas
Copy link
Owner

thoas commented Mar 25, 2022

@metalrex100 I will, it will be available next week :)

@metalrex100
Copy link

@thoas is there any functions that you did not implement so far with generics?
I may provide PR's with their implementation 🙂

@andig
Copy link

andig commented Apr 1, 2022

@metalrex100
Copy link

metalrex100 commented Apr 1, 2022

Hum, when @thoas told that branch with generics will be available for contribution next week, I did not expect it will be at the end of the week (not available so far).
GO 1.18 has been released more than 2 weeks ago and 2 most popular packages with helpers (go-funk and lo) can't provide operational maintenance for generics.

V2 branch with generics support could be released asap, so interested in generics community would provide PR's for helpers they are interested in.

Instead currently everyone, who wants to use generics helpers, but would like to use it with well-known package instead of self-written implementation are blocked by maintainers of the go-funk and lo packages.

IMO if you are an author of the demanded by community package and you don't have time to actively maintain package - need to find more maintainers.

@andig
Copy link

andig commented Apr 1, 2022

Instead currently everyone, who wants to use generics helpers, but would like to use it with well-known package instead of self-written implementation are blocked by maintainers of the go-funk and lo packages.

I don't feel blocked. Instead I can continue using this excellent module or move to any generics-based package including my ohne patches until something more mature comes up. Big thank you to @thoas for all his work sofar.

@metalrex100
Copy link

@andig when codebase is pretty big - it require to spend much time on replacing your self-written solutions with some well-known package.

@thoas
Copy link
Owner

thoas commented Apr 5, 2022

@andig when codebase is pretty big - it require to spend much time on replacing your self-written solutions with some well-known package.

Yes, it takes more time than expected I will have a first draft a the end of the week. I have created a v2 branch, you can send me some PRs if you want.

I don't want to rush it, since it will be a complete rewrite and a lot of BC :)

@metalrex100
Copy link

@thoas it will be actually almost another lib. Methods names will be still the same))

@thoas
Copy link
Owner

thoas commented Apr 5, 2022

@thoas it will be actually almost another lib. Methods names will be still the same))

Yes, that's why it will be separated to a complete new branch and installed via gomod using github.com/thoas/go-funk/v2/. There is a lot of things to rewrite and we must focus on basic utilities first.

@metalrex100
Copy link

@thoas indeed. New implementation also must be placed in v2 folder according to GO versioning system.

@metalrex100
Copy link

Or you want to deal with versioning by always having 2 branches instead of single master with 2 directories: root and v2?

@thoas
Copy link
Owner

thoas commented Apr 5, 2022

branches will be used to separate implementations between generics and non-generics, the same way go-redis is doing it for example.

People will be able to send PRs on v1 too.

@voctior
Copy link

voctior commented Dec 27, 2022

Two weeks passed . @thoas

@thoas
Copy link
Owner

thoas commented Dec 28, 2022

@gopherhw I know, lack of time :)

@yangxikun
Copy link

Is there any progress on this?

@GRbit
Copy link
Author

GRbit commented Apr 13, 2023

@yangxikun to be honest, zero from my side. I switched to github.com/samber/lo

@thoas
Copy link
Owner

thoas commented Apr 13, 2023

You can switch to samber/lo which is pretty complete.

@thoas thoas closed this as completed Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants