Encapsulation, inheritance and polymorphism

Devin Jeanpierre 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
> limited.

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
classes).

> 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?

-- Devin



More information about the Python-list mailing list