2 ms·
It would allow you to write type constructors over lists of types. For instance, if you're writing an ECS manager, you could write something like: struct
by PoignardAzur 4y ago
It would allow you to write type constructors over lists of types.
For instance, if you're writing an ECS manager, you could write something like:
struct SystemManager<...Systems: System> { ... }
// in user code
let my_system: SystemManager<Collisions, 3dModels, PlayerInput, Networking, EnemyAi> = ...
Also, it would make it a lot easier to write some macros; with variadic generics, derive macros could just generate a call to a variadic implementation (thus producing fewer tokens, thus better compile times), and have that implementation handle the bulk of the logic. Unlike a macro body, this macro would be type-checked at the writing site, leading to fewer post-monomorphization errors.