Summary: std.algorithm.find is too much hard to understand
           Product: D
           Version: 2.041
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos

--- Comment #0 from 2010-03-10 06:23:10 PST ---
The find() of std.algorithm is too much hard to understand. I can't understand
how to use it and what it returns.

It's even hard to understand this in the docs page:

FindResult!(Range,Ranges) find(alias pred = "a == b", Range, Ranges...)(Range
haystack, Ranges needles);
struct BoyerMooreFinder(alias pred,Range);
BoyerMooreFinder!(binaryFun!(pred),Range) boyerMooreFinder(alias pred = "a ==
b", Range)(Range needle); 

Such functions must be simple enough for normal people to use. If you need more
than 10 minutes to understand how to use something as simple as a "find", then
the library API is badly designed. It's not a limit of my brain, it's a problem
in the library design.

If I need to know that the substring "foo" is present in "abfoobar" in Python I

"foo" in "abfoobar"

This covers 85%+ of the cases in normal programs.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to