3 ms·
> I'm surprised other languages don't allow this. Rust doesn't (arbitrary values, anyway, const generics is the start of this being possible) because we don't
by steveklabnik 6y ago
> I'm surprised other languages don't allow this.
Rust doesn't (arbitrary values, anyway, const generics is the start of this being possible) because we don't have templates, we have generics. I agree if you're going with a template-based system, it makes a lot of sense to accept whatever, but if you aren't, then things are more complicated.
- mhh__ 6y agoI think the typechecking here should be possible for rust in the sense that it's just a value of a known type (this isn't like C++ hacks). https://d.godbolt.org/z/Tb5jKv4ns https://d.godbolt.org/z/Tb5jKv4ns
- steveklabnik 6y agoIt's possible, (and I think might even work on nightly? Don't have the time to check right this second) but is just a lot more work to support than in a template-based system, that's all. We'll get there!