deprecating std.stream, std.cstream, std.socketstream

Steven Schveighoffer schveiguy at yahoo.com
Wed May 16 10:27:50 PDT 2012


On Wed, 16 May 2012 13:21:37 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 5/16/2012 9:41 AM, Stewart Gordon wrote:
>> On 16/05/2012 16:59, Walter Bright wrote:
>>> On 5/16/2012 7:38 AM, Steven Schveighoffer wrote:
>>>> On Wed, 16 May 2012 09:50:12 -0400, Walter Bright  
>>>> <newshound2 at digitalmars.com>
>>>> wrote:
>>>>
>>>>> On 5/15/2012 3:34 PM, Nathan M. Swan wrote:
>>>>>> I do agree for e.g. with binary data some data can't be read with  
>>>>>> ranges (when
>>>>>> you need to read small chunks of varying size),
>>>>>
>>>>> I don't see why that should be true.
>>>>
>>>> How do you tell front and popFront how many bytes to read?
>>>
>>> std.byLine() does it.
>>
>> And is what you want to do with a text file in many cases.
>>
>>> In general, you can read n bytes by calling empty, front, and popFront  
>>> n times.
>>
>> Why would anybody want to read a large binary file _one byte at a time_?
>
> You can have that range read from byChunk(). It's really the same thing  
> that C's stdio does.

This is very wrong.  byChunk doesn't cut it.  The number of bytes to  
consume from the stream can depend on any number of factors, including the  
actual data in the stream.  For instance, I challenge you to write an  
efficient (meaning no extra buffering) byLine using byChunk as a base.

-Steve


More information about the Digitalmars-d mailing list