Does D have too many features?

so so at so.so
Tue May 1 10:35:33 PDT 2012


On Tuesday, 1 May 2012 at 14:41:43 UTC, SomeDude wrote:
> On Tuesday, 1 May 2012 at 14:31:25 UTC, Alex Rønne Petersen 
> wrote:
>>
>> 1) So because some people might use a feature incorrectly due 
>> to lack of knowledge in algorithms and data structures, we 
>> should cripple the language?
>
> It's not crippling the language. Nothing prevents you from 
> writing a loop.
> Or using a library find function that does the same thing. But 
> the name "find" gives you a hint that it's not magical and that 
> it has a cost, while with "if( foo in bar)", it is too easy to 
> forget that we are actually potentially performing an O(n) 
> operation. In an AA, the 'in' keyword performs a O(1) 
> operation, so that's ok to use it as a syntactic sugar.

I remember this was the argument Andrei also came up. Still can't
make any sense out of it. If someone have some detailed reference
please share! If you have it just for a niche usage, why do you
have it at all? With UFCS "bar.contains(foo)" precise enough.

You can make same argument for every operator in any language if
you have operator overloading. And it would be against operator
overloading, not particularly "in".

--
Didn't know "http://forum.dlang.org/" adopted that
unreadable/annoying to no end captchas.


More information about the Digitalmars-d mailing list