Another new io library

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 18 13:02:17 PST 2016


On Thu, Feb 18, 2016 at 03:20:58PM -0500, Steven Schveighoffer via Digitalmars-d wrote:
> On 2/18/16 2:53 PM, Wyatt wrote:
> >On Thursday, 18 February 2016 at 18:35:40 UTC, Steven Schveighoffer wrote:
> 
> >>But the concept of what constitutes an "item" in a stream may not be
> >>the "element type". That's what I'm getting at.
> >>
> >Hmm, I guess I'm not seeing it.  Like, what even is an "item" in a
> >stream?  It sort of precludes that by definition, which is why we
> >have to give it a type manually.  What benefit is there to giving the
> >buffer type separately from the window that gives you a typed slice
> >into it? (I like that, btw.)
> 
> An "item" in a stream may be a line of text, it may be a packet of
> data, it may actually be a byte. But the compiler requires we type the
> buffer as something rigid that it can work with.
> 
> The elements of the stream are the basic fixed-sized units we use (the
> array element type). The items are less concrete.
[...]

But array elements don't necessarily have to be fixed-sized, do they?
For example, an array of lines can be string[] (or const(char)[][]). Of
course, dealing with variable-sized items is messy, and probably rather
annoying to implement.  But it's *possible*, in theory.


T

-- 
People tell me that I'm paranoid, but they're just out to get me.


More information about the Digitalmars-d mailing list