Should this work?

Regan Heath regan at netmail.co.nz
Fri Jan 24 03:49:28 PST 2014


On Fri, 24 Jan 2014 08:21:12 -0000, Jacob Carlborg <doob at me.com> wrote:

> On 2014-01-23 21:53, Andrei Alexandrescu wrote:
>
>> Ionno. Just look at the current morass with
>> https://github.com/D-Programming-Language/phobos/pull/1875. We have two
>> names for the same function "canFind" and "any". Then we want to
>> deprecate one, but look at how much impact it's having on Phobos alone.
>> Are you sure you want to add a _third_?
>
> Personally I would expect "any" to take a predicate and return "true" if  
> it can find any matching element. If a predicate is not supplied it  
> would behave as the opposite of "empty".

Yep, this is what the C# version does.

> I would expect "contains" to take a element and check if it exists in  
> the range.

Except in the case of string, where we also want an overload taking more  
than a single element aka a substring.

> I think "canFind" is just a weird name.

Me too, but it makes sense as a "generic" name I think.

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list