"in" everywhere

Steven Schveighoffer schveiguy at yahoo.com
Fri Oct 8 04:32:42 PDT 2010


On Thu, 07 Oct 2010 19:28:59 -0400, Michel Fortin  
<michel.fortin at michelf.com> wrote:

> On 2010-10-07 18:53:51 -0400, Andrei Alexandrescu  
> <SeeWebsiteForEmail at erdani.org> said:
>>  "Input" == "Input to the program" i.e. not known during compilation of  
>> the program.
>
> Sorry, but my interpretation in this context is that "Input" should be  
> "Input to the 'in' operator". Sure, it won't affect the complexity of  
> the program if the input of the operator is constant, but the complexity  
> of that operator is still linear in the sense that the time it takes for  
> one search scales linearly with the size of the input. That the size of  
> the input is decided at runtime or at compile time does not change the  
> complexity of the operator, nor does it make it less stupid to use the  
> operator on arrays longer than a few elements.
>
> "in" shouldn't be allowed to perform a linear operation, and I mean  
> linear relative to the size of it's input.
>

100% agree.  If it can do something non-linear (i.e. auto sort the array  
or optimize using a static hash table), then I think that's fine.

-Steve


More information about the Digitalmars-d mailing list