protocol for using InputRanges

QAston qaston at gmail.com
Fri Mar 28 11:36:14 PDT 2014


On Friday, 28 March 2014 at 08:34:08 UTC, Johannes Pfau wrote:
> Am Thu, 27 Mar 2014 17:20:25 -0700
> schrieb Walter Bright <newshound2 at digitalmars.com>:
>
>> On 3/27/2014 2:56 PM, Andrei Alexandrescu wrote:
>> > On 3/27/14, 2:24 PM, Walter Bright wrote:
>> >> The range protocol is designed to work with streams.
>> >
>> > It's designed to work with containers.
>> 
>> I know we talked about streams when we designed it.
>> 
>> 
>> >> It's a giant fail
>> >> if they do not, or if you want to create a separate, 
>> >> non-range
>> >> universe to deal with streams.
>> >
>> > It's not a giant fail, we just need to adjust the notion.
>> 
>> Are you suggesting that ranges needn't support streams?
>> 
>> Note also that I suggested a way Steven could create an 
>> adapter with
>> the behavior he desired, yet still adhere to protocol. No 
>> notion
>> adjustments required.
>
> Ranges have equivalents in other languages:
> iterators in c++,
> IEnumerator in c#,
> Iterator in java
>
> all these languages have special stream types for raw data. I 
> don't
> think it's bad if we also have streams/ranges separate in D.

There are stream iterators in C++:
http://www.cplusplus.com/reference/iterator/istream_iterator/


More information about the Digitalmars-d mailing list