-
-
Notifications
You must be signed in to change notification settings - Fork 416
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
Question: Is there planned support for iterator in version 1.23? #687
Comments
Hey @amikai Yes, definitely. I'm going to work on bring support for Go iterators in Expr. |
Hi @antonmedv, Although I am not familiar with the source code for expr, I would like to try working on this feature. If it's convenient for you, could you please explain how to proceed, mention any high-level steps, or reference similar PRs? I will evaluate my capabilities to decide whether to take on this task. If this change affects a large portion of the source code and you prefer to handle it yourself, just let me know. |
Sure you can try next things. First of all find an example of using an iterator and thing what is not working in expr. |
Take
The built in function with predicate look like directly compile to byte code , that i quite not understand that part (compiler fundamental). I think I can't help, so I'll leave what I imagined before here. I hope it helps you when you're working on it.
|
Nice 👍🏻 I like how you evaluated all the builtin functions. We can use it to better plan the feature. One point about map:
I think map will return array. Not seq. As lazy evaluation is more complicated. |
Hi @antonmedv, I hope you're doing well. I wanted to share my thoughts on the map function for For example, a scenario that I think could be beneficial is to prevent exhausting the entire array with a predicate:
|
Hi @antonmedv
Golang 1.23 will support the iter package and define the type
Seq[V any]
as an iterator. The expr package supports numerous array functions. I believe iterators will be widely used in many libraries in the future. Is there any plan for these array functions to support not only arrays but also iterators in version 1.23?Use slice.Values as example
I understand this example is quite simple and not necessary (because we can directly use the array in any). However, please imagine that the iterator might not be iterating over an array.
Reference
https://tip.golang.org/doc/go1.23
https://pkg.go.dev/iter@master
The text was updated successfully, but these errors were encountered: