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

Good point. But how can you know the types statically (at development-time) without defining interfaces?


You could specify that your method takes an object which has method XYZ accepting an int as its parameter and returning another int -- a kind of "anonymous" interface, I guess. Personally I don't like this kind of stuff because there's no guarantee that two objects with a convert method do the same thing when that method is called.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: