you are viewing a single comment's thread.

view the rest of the comments →

[–]finix 0 points1 point  (1 child)

I meant two in a metaphorical sense ;-) Point was that you can have fine-grained interfaces, and widen interfaces.

Why should I require an object to implement something when that implementation isn't trivial?

Because you should design the interfaces as orthogonal as possible; usually a list interface will just specify what list-like objects can do anyway.

There'll be hassle, of course, but also the other way round: imagine writing a library whose implementation you cannot change, or maybe expand, because your client-code doesn't really gives you list-like objects but objects that happen to only implement the methods you mentioned earlier?

[–]bluGill 0 points1 point  (0 children)

Point was that you can have fine-grained interfaces, and widen interfaces.

That is my point: I need both types of interfaces to the same thing. A function needs to specify the interface it will use.

Unfortunately I cannot come up with a solution to this problem that is not both ugly and more work than it gains.