July 09, 2012
On Monday, 9 July 2012 at 16:06:57 UTC, Timon Gehr wrote:
>
> Consider the possibility that this electrical engineer might be a plumber as well.

Yes, so if you expect him to be, then you should ask him "are you a plumber?" (i.e. output range?)


But what you're asking him right now is, "hey, can you do clear this pipe for me with copper wires??" which is downright silly. Being able to write to an output range does NOT require you to have 'ref' members. The only thing 'ref' ever buys you is performance, not any new capabilities. Depending on it doesn't make sense.
July 09, 2012
Perhaps if you could show an actual example of what you expect to be able to do, that would make things clearer?
July 09, 2012
On 07/09/2012 06:17 PM, Mehrdad wrote:
> On Monday, 9 July 2012 at 16:06:57 UTC, Timon Gehr wrote:
>>
>> Consider the possibility that this electrical engineer might be a
>> plumber as well.
>
> Yes, so if you expect him to be, then you should ask him "are you a
> plumber?" (i.e. output range?)
>
>
> But what you're asking him right now is, "hey, can you do clear this
> pipe for me with copper wires??" which is downright silly.

The range is an input range of references. It could just as
well be an input range of setters. I do not see why the notion of
'input range' should restrict the kinds of elements that are accessed
by iterating the range. It would be downright silly.

> Being able to
> write to an output range does NOT require you to have 'ref' members. The
> only thing 'ref' ever buys you is performance, not any new capabilities.
> Depending on it doesn't make sense.

sort!"a[0]<b[0]"(zip(ra1,ra2));
July 09, 2012
On Monday, 9 July 2012 at 16:25:06 UTC, Timon Gehr wrote:
> I do not see why the notion of 'input range' should restrict the kinds of elements that are accessed by iterating the range. It would be downright silly.

Yes... but when did I ever impose anything on the /elements/? I never even used that word.

I imposed constraints on the range, and the range only...

> sort!"a[0]<b[0]"(zip(ra1,ra2));

sort():
"Sorts a random-access range according to predicate less."


What does that have to do with input ranges?
July 09, 2012
On 07/09/2012 06:27 PM, Mehrdad wrote:
> On Monday, 9 July 2012 at 16:25:06 UTC, Timon Gehr wrote:
>> I do not see why the notion of 'input range' should restrict the kinds
>> of elements that are accessed by iterating the range. It would be
>> downright silly.
>
> Yes... but when did I ever impose anything on the /elements/?

On 07/09/2012 06:04 PM, Mehrdad wrote:
>
>> With your design you need to add something extra to allow writing to elements of a single-pass range.
>...
> That capability is simply /not needed/ when your /only/ contract is that something is an input range.


> I never even used that word.
>

Unlikely.
July 09, 2012
On Monday, 9 July 2012 at 16:42:52 UTC, Timon Gehr wrote:
> On 07/09/2012 06:04 PM, Mehrdad wrote:
>>
>>> With your design you need to add something extra to allow writing to elements of a single-pass range.
>>...
>> That capability is simply /not needed/ when your /only/ contract is that something is an input range.
>
>
>> I never even used that word.
>>
>
> Unlikely.


Huh? Isn't that Andrei's post?
July 09, 2012
On 07/09/2012 06:47 PM, Mehrdad wrote:
> On Monday, 9 July 2012 at 16:42:52 UTC, Timon Gehr wrote:
>> On 07/09/2012 06:04 PM, Mehrdad wrote:
>>>
>>>> With your design you need to add something extra to allow writing to
>>>> elements of a single-pass range.
>>> ...
>>> That capability is simply /not needed/ when your /only/ contract is
>>> that something is an input range.
>>
>>
>>> I never even used that word.
>>>
>>
>> Unlikely.
>
>
> Huh? Isn't that Andrei's post?

On 07/09/2012 11:14 AM, Mehrdad wrote:
> element
July 09, 2012
On Monday, 9 July 2012 at 16:50:44 UTC, Timon Gehr wrote:
> On 07/09/2012 11:14 AM, Mehrdad wrote:
>> element

Link to exact post please?
July 09, 2012
(or it didn't happen :P)
July 09, 2012
On Monday, 9 July 2012 at 16:22:05 UTC, Mehrdad wrote:
> Perhaps if you could show an actual example of what you expect to be able to do, that would make things clearer?

It is useful to be able to write an algorithm that both reads
and writes range elements. There are plenty of use cases for
that, but if you really need an example, here's a simple one:

void transform(alias f, R)(R r)
    if(isInputRange!R && hasAssignableElements!R)
{
    for(; !r.empty; r.popFront())
        r.front = unaryFun!f(r.front);
}