Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Compile-time duck typing :) To be fair, C++ templates have a similar problem. Rust nails this one with traits, I think.


C++17 has mechanism to validate if a type implements a certain "interface" (pure virtual base class) via type traits, if constexpr and enable_if, and hopefully with concepts a solution similar to traits will then be possible (already available on gcc).




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: