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

Unfortunately, I've spent more-time-than-I-should time over the years debugging issues where a subclass was supposed to have overriden a superclass method's behavior but the subclass method had the wrong method signature (and thus was never called). Console log statements never lie..


The idea that different methods can have the same name but different signatures presents many challenges. IMO, if you are going to live with the drawbacks, you ought to be able to enjoy all of the benefits, such as you will find in full-features MOPs like in Common Lisp or pattern-matching languages like Haskell.

BTW, Ruby and Java both solve this problem. In Java, use the @override annotation. If you are not overriding a method, you get a compiler error.

Ruby "solves" the problem by only having one method per name. But you can mix in some magic and get pattern matching if you want.




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: