3 ms·
This sounds cool. You mentioned Swift's macros - would you mind talking a bit how you are using them?
by kenshi 6mo ago
This sounds cool. You mentioned Swift's macros - would you mind talking a bit how you are using them?
- alex_x 6mo agoa lot of cool-looking stuff in my ECS is supported by Swift parameter packs; however, once you start using them a lot you find limits pretty soon. One example: the following wouldn't compile in swift: func query<each T, each K>( _ body: ((repeat each T), (repeat each K)) -> Void ) { ... } so you kinda work around it with extra type wrappers but this looks ugly - I've been using macros to hide some of the ugliness away xD edit: the example is oversimplified just to show the point - in this example compiler can't really tell where T ends and K starts, so its logical; but I had more complex cases where a human would've been able to infer types correctly