On Wed, 16 May 2012 10:47:23 -0400, Tobias Pankrath <pa...@tzi.de> wrote:

Andrei you are against an in-operator for array, because it would provide a uniform interface for arrays and AA with different complexity. Is contains with different complexity for ranges and for SortedRange not the same?

No it's not the same.

It all depends on what the function advertises as its complexity.

It's OK for a function that advertises O(n) complexity to be applied to a type that's optimized into O(lgn) complexity.

But it's NOT OK for a function that advertises O(lgn) complexity to be applied to a type that requires O(n) complexity.

It all depends on what the existing situation is. Generic code is written against the documentation, because it doesn't know what's actually going to be implemented underneath.

-Steve

Reply via email to