-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
more efficient tuple representation #2496
Comments
I should also say that it's not entirely obvious how one might use |
Would immutable tuples accomplish this? It seems like a cleaner solution. |
Triples are always immutable. Not sure about the rest, or that I even understand the original request :-\ |
@StefanKarpinski I think the idea was to insert N Int fields into the type. @timholy, based on what Stefan just said, your latter suspicion might be false. |
Sorry, I didn't explain it very well. It might be clearer with a more fleshed-out example. I'm looking to build iterators over all pixels in an image, or over pixels in 2D slices of 3D images, etc. To be able to support both arrays and subarrays, I'm envisioning a family like this:
This gets tiresome much above 3D. The good news that's probably all that really matters for image processing, but I was wondering whether there is a solution for the general case.
Tuples won't work for what I want to do because they involve allocation. I first tried implementing Grid's |
Actually, in this example I should have focused here on the |
There are actually two features here: the ability to specify different definitions for different parameter values, and structs with a variable number of fields (different since in that case the number of definitions is not finite). Instead of adding both of those, I think the solution is to make tuples more efficient. Structs have now gotten a huge amount of work, and tuples have been largely neglected. |
Definitely, making |
Is there a correct syntax for doing this?
If so, one could create types
Iterator{1}
,Iterator{2}
, etc, via metaprogramming. I suspect that the alternative,will not yield the kind of benefits we might want.
The text was updated successfully, but these errors were encountered: