4 ms·
> In C++ you could define an iterator So on one hand you use the specific term "iterator" for a concept that's slightly different than the general idea of loop
by alpaca128 4y ago
> In C++ you could define an iterator
So on one hand you use the specific term "iterator" for a concept that's slightly different than the general idea of looping through a datastructure, but then "coiteration" is a step too far? Where do you draw the line, at the limits of the C++ standard library?
> Whatever is going on underneath doesn't matter
Performance matters and is often based on what is going on underneath.
- CyberDildonics 4y agoSo on one hand you use the specific term "iterator" for a concept that's slightly different than the general idea of looping through a data structure True, but an iterator is a specific value that can be incremented for the next value. It helps loop through a data structure when that data structure can't be indexed by sequential values. but then "coiteration" is a step too far? Where do you draw the line, at the limits of the C++ standard library? An iterator helps loop through a data structure. Coiteration is iteration, there isn't a separate concept here. Performance matters and is often based on what is going on underneath. You need to understand the context here, this is about the interface. Basically there is no need to use a different language or hallucinate words to act like they invented something. The entire paper could just be a C++ class and someone using their data structure wouldn't have to give up the C++ eco system. As it stand, no one is going to use an entirely different language to use one data structure.
- alpaca128 4y ago> Coiteration is iteration, there isn't a separate concept here. It is a subset that the paper seems to focus on, so using precise language is useful in this case. Just like a study about humans will use the word "human" instead of "mammal". > no one is going to use an entirely different language to use one data structure. It seems to me that the goal is more about approaches for specific compiler optimizations/code generation, not to replace C++.
- CyberDildonics 4y agoIt is a subset that the paper seems to focus on, Iteration though is already used when looping through something is non trivial. It isn't necessary for an array or vector because those have random and sequential integer indices. Iterators are made for situations like this where it is more complex under the hood. What no one can say is why this can't be covered by giving the user an iterator. You say next, it gives you the next item, pair etc. It seems to me that the goal is more about approaches for specific compiler optimizations/code generation Based on what? The title is "A Language for Structured Coiteration" and most of the paper is about the internal of the data structure. not to replace C++. No one said that, I asked why this couldn't be done in C++ as a class. Then you wouldn't even have to use a different language.
- topaz0 4y ago> > the goal is more about [...] optimizations/code generation > based on what? From the abstract: Specializing for structure yields significant speedups. But automatically generating efficient code for structured data is challenging, especially when arrays with different structure interact. We show how to abstract over array structures so that the compiler can generate code to coiterate over any combination of them. i.e. yes could write your own iterator to efficiently co-iterate over any given pair of structured arrays, and this is a way to express the structure to a compiler so you won't have to figure out the right optimizations yourself every time you want to try out a new way of structuring your data.
- alpaca128 4y ago> What no one can say is why this can't be covered by giving the user an iterator This is about abstractions for the compiler to optimize that iterator given to the user. Seriously, you could have just read the linked abstract.
- CyberDildonics 4y agoThe abstract doesn't explain the term "coiteration" at all