We need better documentation for functions with ranges and templates

dnewbie via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 15 06:08:34 PST 2015


On Tuesday, 15 December 2015 at 09:57:00 UTC, ZombineDev wrote:
> On Monday, 14 December 2015 at 19:56:29 UTC, dnewbie wrote:
>> On Monday, 14 December 2015 at 19:04:46 UTC, bachmeier wrote:
>>> It's unanimous, at least among the three of us posting in 
>>> this Reddit thread:
>>> ...
>>
>> Take for example C# Docs: 
>> https://msdn.microsoft.com/en-us/library/system.collections.arraylist.addrange.aspx
>>
>> Syntax C#:
>>
>> public virtual void AddRange(
>> 	ICollection c
>> )
>>
>> Parameters:
>>     c
>>     Type: System.Collections.ICollection
>>     The ICollection whose elements should be added to the end 
>> of the ArrayList. The collection itself cannot be null, but it 
>> can contain elements that are null.
>>
>> Clean, simple and instructive!
>>
>
> You are really comparing apples to oranges...

If you look here: 
http://forum.dlang.org/post/xiduyyulihesjgjxmgnd@forum.dlang.org

I said: "but the main focus here was about the simplicity of the 
layout used in the C# doc. You can see others examples there 
easily including templates and generics interface."

So I was talking about one example vs another, in this case 
isSameLength, which I suggested something like:

Syntax:
     bool isSameLength(Range1, Range2)(Range1 r1, Range2 r2)
Parameters:
     Type r1, r2 : Input range.
     Both r1, r2 : needs to be finite.

Instead of:

bool isSameLength(Range1, Range2)(Range1 r1, Range2 r2) if 
(isInputRange!Range1 && isInputRange!Range2 && !isInfinite!Range1 
&& !isInfinite!Range2);

But you know I'm newbie...

Ron.


More information about the Digitalmars-d mailing list