-
Notifications
You must be signed in to change notification settings - Fork 313
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
Add macro iunpack
#841
Add macro iunpack
#841
Conversation
Hi there, this is some impressive macro-programming. But from a user's perspective: Is this really better than a manual I think itertools should provide (relatively) fool-proof and intuitive helpers, and I don't think |
I think it's easy to understand, and we have macro expand, right? |
For example, it can unpack structures or verify the correctness of enumerations when unpacking iterators, which will be extremely convenient and can simplify many codes |
And this macro implementation can effectively handle iterators with variable numbers of elements for quick single branch matching at the beginning and end, without the need for lengthy code. |
It seems powerful but quite unusual at first sight, and all those loop-break around the macro (but I guess it could be presented differently). I get that you understand everything here as you made it but it's not that easy. I would agree with phimuemue. After looking at the internals, I need to say that we currently use stable Rust 1.43.1 and "let-else" is not available for us yet (and 1.65 is not for tomorrow). Honestly after all the debate of |
Regarding the issue of let-else, may it be possible to modify it to an internal code block? |
Having changed it to use if-let, is it available now? |
Can it run now? Can it be merged? |
I just let our CI run, it passed (thanks to the removed "let-else") which does not mean it'll be merged. The "merge process" might be considered slow for new additions and especially for something that is not easy like this. But if we add something, we commit ourselves to maintain it. |
I hope I do not come across as rude, but this did not change my opinion. Imho this macro - while impressive - has downsides:
I think this has its place in a code-golf/AoC-like crate, but not in itertools. But I won't veto if @Philippe-Cholet or @jswrenn wants to merge. |
I think this is the biggest things that, personally, pushes me away from saying this is a good fit for itertools. The other macros that exist are about handling a variable number of heterogeneous parameters, where macros are the only reasonable option today, but which act far more like functions. ( But |
I think we three agree that it is a nice and powerful macro that does not really fit our crate. |
Closing, outside the scope of itertools. |
Add it, simply and quickly unpack iterators to patterns.