protocol for using InputRanges

Steven Schveighoffer schveiguy at yahoo.com
Thu Mar 27 14:14:40 PDT 2014


On Thu, 27 Mar 2014 17:06:35 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 3/27/2014 5:45 AM, "Ola Fosheim Grøstad"  
> <ola.fosheim.grostad+dlang at gmail.com>" wrote:
>> On Thursday, 27 March 2014 at 12:35:04 UTC, Steven Schveighoffer wrote:
>>> I think we should work on making a protocol that does not require  
>>> awkward
>>> calls, rather than alienating developers who don't follow the awkward  
>>> protocol.
>>
>> This is it.
>
> Sure, but what is awkward about empty-front-popFront?
>
> You can still always use:
>
>      foreach (e; range) { ... }
>
> which will follow the correct protocol automatically.

If this is all we needed, ranges would never have been invented.

-Steve


More information about the Digitalmars-d mailing list