3 ms·
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 ma
by TylerE 15y ago
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?
- bhickey 15y agoI 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.html 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!
- TylerE 15y agoThe 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.
- deleted 15y ago[deleted]
- deleted 15y ago[deleted]