-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
D-style (higher-order) (lazy) ranges #1160
Comments
My lazy zig library may be a good starting point :). |
If and when Zig decides to add ranges I suggest digging into Rust's iterators, D's std.range and std.algorithm and Eric Nieblers' corresponding C++-solution range-v3 for inspiration. There are lots of details that have to work in symphony to make higher-order lazy ranges/iterators expressive, easy to use and performant. Please don't repeat the mistake C++ did with its iterator library for C++98 by making the iterator a generalization of pointers. It's too low-level and too error-prone to use. I believe Rust's API with a function Note, however, that D provide a clever way of exposing the property of infiniteness (generator) of a range; making the function |
There is no plan for this feature. However pay attention to the coroutine rewrite (#2377) because it's possible Zig may gain generators out of it. |
Are there any plans on adding D-style (higher-order) (lazy) ranges to Zig?
Preferrably with compile-time inference of capabilities such as:
isRandomAccessRange
) returning a wrapper range exposing a sortedness property att compile-time.sort(chain(a,b,c, ...))
works becausechain(a, b, c)
is random access iffa
,b
andc
are all random access.The text was updated successfully, but these errors were encountered: