Pergunta de entrevista da empresa OKG

Explain the difference between Generics vs Trait Objects

Resposta da entrevista

Sigiloso

11 de fev. de 2026

Generics - Faster compile, larger binaries. Used when types are known and performance matters. Basically a normal fn function that takes arguments Trait Objects - When flexibility at runtime is needed with not always known variables. Slower performance but less binary size. More concerned with what things do. Nuanced and dependent on situation.