Encapsulation, inheritance and polymorphism
jeanpierreda at gmail.com
Tue Jul 17 21:05:26 CEST 2012
On Tue, Jul 17, 2012 at 1:07 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> 'type-bondage' is the requirement to restrict function inputs and output to
> one declared type, where the type declaration mechanisms are usually quite
This is interesting, I hadn't expected that sort of definition. So
Haskell is not a type-bondage language?
(i.e. it lets you write functions that accept any type via parametric
polymorphism, or any type that supports an interface via type
> How easy was it to write max, or a universal sort in Java?
You write obj.compareTo(other) < 0 instead of using obj < other, and
your methods only work on objects (that support the comparable
interface). Otherwise, no different than Python, I guess.
Would Java not be a type-bondage language if everything was an object?
More information about the Python-list