On 2013-02-13, 21:19, Walter Bright wrote:

On 2/12/2013 11:34 PM, Jacob Carlborg wrote:
On 2013-02-12 22:35, Walter Bright wrote:

The trivial ones should not be added to Phobos, for example, 'any' being
defined as '!empty'. Such things add cognitive load but no value.

This is just an extension to the already existing std.algorithm.any function. I think it adds value, that's why I have it. It clearly shows the intent. It's the same reason why I think it's good to have explicit interfaces and abstract
classes in opposite of how it works in C++.



The any in std.algorithm is defined:

--------------
bool any(alias pred, Range)(Range range);

Returns true if and only if a value v satisfying the predicate pred can be found in the forward range range. Performs Ο(r.length) evaluations of pred.
--------------

I see that as very different from !empty.

In C#, the Any function may be called with or without a predicate.
With one, it works as what is already in std.algorithm. Without, it works
like Jacob describes.

--
Simen

Reply via email to