Remix.run Logo
▲ ModernMech an hour ago

Other languages support generics, monomorphization, and iterators (e.g. Zig or D), but they're not as slow as Rust to compile, what's the reason for that?

▲tialaramex 32 minutes ago | parent | next [-]

It's likely easier to answer for specific languages

All three of those words can mean "just like Rust" but equally "Not at all like Rust" for different languages.

Two examples to contrast: In C++ the iterators are basically a pointer analog (in some cases they're just literally pointers) and that's a very difference "feature" but it's still definitely iterators. In Ginger Bill's Odin, the iterators are a function, possibly generic, which returns a pair, the next item and a boolean telling you whether the iterator was exhausted.

▲moritzruth 40 minutes ago | parent | prev [-]

AFAIK it's because of trait solving. And also not every language does monomorphization.