Lost a new commercial user this week :(

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 15 00:27:25 PST 2014


On 2014-12-14 22:00, Kiith-Sa wrote:

> One thing I ran into often when I was inexperienced with D:
>    the template constraints make some signatures extremely messy, and it
> takes a while to figure out when you have e.g. 3 template functions of
> the same name in
> std.algorithm, all with crypric signatures.
>
> Example:
>
> ptrdiff_t countUntil(alias pred = "a == b", R, Rs...)(R haystack, Rs
> needles) if (isForwardRange!R && Rs.length > 0 && isForwardRange!(Rs[0])
> == isInputRange!(Rs[0]) && is(typeof(startsWith!pred(haystack,
> needles[0]))) && (Rs.length == 1 || is(typeof(countUntil!pred(haystack,
> needles[1..$])))));
> ptrdiff_t countUntil(alias pred = "a == b", R, N)(R haystack, N needle)
> if (isInputRange!R && is(typeof(binaryFun!pred(haystack.front, needle))
> : bool));
>
> countUntil is trivial to use, but the docs make it seem complicated
> and it takes a while to read them.
> (This is not really a good example as with countUntil it's not *that*
>   bad, but I think it should be enough to show the problem)
>
> In this specific case, it would be useful if the constraint was somehow
> separated from the rest of the signature and less emphasized (CSS).

I made a suggestion for simplifying signatures in the documentation here [1]

[1] http://forum.dlang.org/thread/lt1hai$186b$1@digitalmars.com

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list