Hey,
It is the second time I run into this kind of thing, where I can not avoid the use of generics.
The last time, I wanted to copy data between worlds without using generics. This is parallelizable, because I know the entities exist only once in each world. I managed to access data from one world using archetype chunk iteration, but I can not anonymously write this to the other world without using generics, because DynamicComponentTypeHandle requires the chunk to access any data (which is not accessible while iterating over another world's entities).
Thus, it's necessary to copy all the data in an intermediate step, and then launching another archetype chunk iteration. This multi-stage data transfer is somewhat difficult to organize in parallel, let alone do so efficiently. I fell back to duplicating some code and writing the data using ComponentTypeHandlesComponentLookups.
In this second case, I want to clear all buffers from a list of buffer types on a specific entity (a list of events). Here, too, there is no way to do this anonymously, but looking at the implementation, this looks like it could be done.
Did anyone have similar "problems", or am I the odd one out? Are there solutions to avoid duplicating code for these kinds of cases (e.g. when adding event types)?