dud: A dub replacement

Rumbu rumbu at rumbu.ro
Wed Nov 20 16:29:20 UTC 2019


On Wednesday, 20 November 2019 at 13:37:39 UTC, Jacob Carlborg 
wrote:
> On Wednesday, 20 November 2019 at 11:40:19 UTC, Robert Schadek 
> wrote:
>
>> Here is disagree, to a degree I consider comments a code smell.
>> If I have to write them, I failed to convey the information
>> needed to understand the code in the code.
>
> You think this is a code smell: 
> https://dlang.org/phobos/std_array.html ?
>
> --
> /Jacob Carlborg

When a function signature looks like this

ElementEncodingType!(ElementType!RoR)[] join(RoR, R)(RoR ror, 
scope R sep)
if (isInputRange!RoR && isInputRange!(Unqual!(ElementType!RoR)) 
&& isInputRange!R && is(Unqual!(ElementType!(ElementType!RoR)) == 
Unqual!(ElementType!R)))

or like this:

E[] replaceFirst(E, R1, R2)(E[] subject, R1 from, R2 to)
if (isDynamicArray!(E[]) && isForwardRange!R1 && 
is(typeof(appender!(E[])().put(from[0..1]))) && isForwardRange!R2 
&& is(typeof(appender!(E[])().put(to[0..1]))));

it's understandable why documentation is mandatory.




More information about the Digitalmars-d-announce mailing list