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

Rust has had dynamic dispatch via since time immemorial, because there are a few things that static dispatch can't express (the original motivating factor was having an array full of different types that all implement the same interface). It is achieved by leveraging a feature of the traits system known as "trait objects": http://doc.rust-lang.org/book/static-and-dynamic-dispatch.ht...

But you are correct in that one of the loudest objections to the potential inclusion of inheritance in Rust is that people don't want two ways of achieving dynamic dispatch, because suddenly then you're in the same boat as C++ where you must decide which incompatible subset of the language to use in your codebase.



Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: