On Friday, 13 March 2015 at 15:17:06 UTC, Andrei Alexandrescu
wrote:
There is something loosely related to curb appeal that has been
discussed here before. Consider someone just starts with D and
wants to figure whether there's a startsWith function in D.
So they google for something like ``dlang startswith''. Nicely
enough http://dlang.org/phobos/std_algorithm.html comes up
first. (Ideally the individual page
http://dlang.org/library/std/algorithm/starts_with.html would
come up.)
Anyhow, assuming the user clicks on the former, startsWith is
easy to find at the top and then when you click on it...
====
uint startsWith(alias pred = "a == b", Range, Needles...)(Range
doesThisStart, Needles withOneOfThese) if (isInputRange!Range
&& Needles.length > 1 &&
is(typeof(.startsWith!pred(doesThisStart, withOneOfThese[0])) :
bool) && is(typeof(.startsWith!pred(doesThisStart,
withOneOfThese[1..$])) : uint));
bool startsWith(alias pred = "a == b", R1, R2)(R1
doesThisStart, R2 withThis) if (isInputRange!R1 &&
isInputRange!R2 &&
is(typeof(binaryFun!pred(doesThisStart.front, withThis.front))
: bool));
bool startsWith(alias pred = "a == b", R, E)(R doesThisStart, E
withThis) if (isInputRange!R &&
is(typeof(binaryFun!pred(doesThisStart.front, withThis)) :
bool));
====
This in big bold font, too. The HTML way of saying, "you wanted
startsWith? I'll give you more startsWith than you can carry."
Picture the effect this has on someone who just wanted to see
if a string starts with another.
I agree https://issues.dlang.org/show_bug.cgi?id=13676
--
Jacob Carlborg