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

With fairness, no you can't, not truly. Please point me to the version of HM the works with inheritance. Plus, due to stuff like __getattr__, the interpreter may not know until the method is called if it even exists.

It would be totally possible in python to write a class where when any arbitrary method is called on a class, a function is randomly generated and called, with a random number of arguments, etc. It doesn't even have to be consistent from call to call. How on earth would H-M type inference cope with that?



I never said inheritance, or method for that matter. You can do H-M on typeclasses. Philip Wadler has a paper on it and it's alive and well in GHC: http://homepages.inf.ed.ac.uk/wadler/topics/type-classes.htm...

The fact that Python allows you to do something absurd is simply an argument against its design.

Edit: Uh oh, looks like I ruffled some snakeskin!


The point is you can't just bolt on H-M to a typical scripting language and expect it to work, like, at all. It's a pretty huge sea change, and it would warp the underlying language to the point where you'd just end up with some of non-lazy, non-pure Haskell.




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

Search: