3 ms·
I find it easier to read code that uses Rust generics with trait bounds, since then I have a clear answer about what types it is generic over. Recently I was us
by john01dav 1y ago
I find it easier to read code that uses Rust generics with trait bounds, since then I have a clear answer about what types it is generic over. Recently I was using a Thrust (CUDA library) function for the first time and I wanted to know what types, exactly, could be accepted as a parameter type to a callable. The docs¹ were not useful, since they only addressed the output type of the callable. I had to ask an LLM and then fact check its sources. This is a much less convenient experience than the information being mandatory in the function signature like in Rust.
1: https://wmaxey.github.io/cccl/thrust/api/function_group__transformations_1ga0ddf108cc4d1109addeed3251824f951.html https://wmaxey.github.io/cccl/thrust/api/function_group__tra...
- Panzerschrek 1y agoC++ optimizes happy path - if you provide an expected type to a piece of template code, all works fine, but if not - you get terrible error messages. Rust requires more boilerplate on happy path, but provides useful hints in case of compilation errors.