3 ms·
Rust traits have the opposite behavior. If it says it’s an iterable, it must quack like an iterable. Something that quacks like an iterable cannot be used as a
by setr 5y ago
Rust traits have the opposite behavior. If it says it’s an iterable, it must quack like an iterable.
Something that quacks like an iterable cannot be used as an iterable, unless the trait is explicitly stated — unlike python, where it simply has to quack.
- yxhuvud 5y agoCrystal would be a better example of a statically compiled language with duck typing.