!in
Pelle Månsson
pelle.mansson at gmail.com
Wed Feb 17 13:53:30 PST 2010
On 02/17/2010 10:25 PM, Andrei Alexandrescu wrote:
> What evidence do you have that it's widely useful?
I use it once in a while in python, evidence enough? :)
> Well I understand you don't agree from the frame you're now in, but you
> haven't heard my argument yet. Under such conditions you shouldn't say
> "can't"! Here goes my argument.
>
> 1. An array literal has no name and cannot be aliased, hence it's
> private to the implementation. The implementation is therefore free to
> induce structure on the searched elements, e.g. by sorting the array or
> using a hash.
>
> 2. The size of an array variable must be conservatively assumed to scale
> with the size of the input. The size of an array literal scales with the
> size of the program, or in the worst case (code generation) with
> statically-known inputs to the program.
I don't see how this is any argument against opIn_r for array variables
as well.
I mean, the argument against it seems to be to make it more difficult to
do a linear search over an array, which seems rather backwards to me.
More information about the Digitalmars-d
mailing list