protocol for using InputRanges

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Mar 28 10:11:42 PDT 2014


28-Mar-2014 21:07, Walter Bright пишет:
> On 3/28/2014 9:48 AM, Dmitry Olshansky wrote:
>> 28-Mar-2014 13:55, Walter Bright пишет:
>>> On 3/28/2014 1:32 AM, Johannes Pfau wrote:
>>>> 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.
>>>
>>>
>>> Do you see a point to be able to, in an algorithm, seamlessly swap a
>>> socket with a string?
>>>
>>
>> Certainly NOT a socket. There is no escaping the fact that there are
>> specifics
>> to unbuffered direct streams.
>> What you mention only makes sense with buffering either implicit or
>> (I'd prefer)
>> explicit.
>
> Yes, it does require a one element buffer. But seriously, does a one
> character buffer from a socket have a measurable impact on reading from
> a network?

WAT? The overhead is in issuing system calls, you'd want to do as little 
of them as possible. Reading byte by byte is an exemplar of idiocy in 
I/O code.

> I'm an efficiency wonk as much or more than anyone, and this
> appears to me to be a false savings.

Oh crap. This is very wrong. Do you often work with I/O and networking?

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list