3 ms·
Oh man, variadic generics. I hope the hope they do on that feature inspires Rust to follow suit. This is a game-changer in terms of expressiveness.
by PoignardAzur 4y ago
Oh man, variadic generics.
I hope the hope they do on that feature inspires Rust to follow suit. This is a game-changer in terms of expressiveness.
- bsaul 4y agoDo you have any example of the kind of things that it would enable ? I must say i've never had the need for this feature, but maybe it's just because i've never used a language that had it..
- PoignardAzur 4y agoIt 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.