Another new io library

Wyatt via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 18 09:16:11 PST 2016


On Thursday, 18 February 2016 at 16:36:37 UTC, Steven 
Schveighoffer wrote:
> On 2/18/16 11:07 AM, Wyatt wrote:
>> This looks pretty all-right so far.  Would something like this 
>> work?
>>
>> foreach(pollItem; zmqSocket.bufferedInput
>>      .as!(zmqPollItem)
>>      .asInputRange)
>
> Yes, that is the intent. All without copying.
>
Great!

> Note, asInputRange may not do what you want here. If multiple 
> zmqPollItems come in at once (I'm not sure how your socket 
> works), the input range's front will provide the entire window 
> of data, and flush it on popFront.
>
Not so great!  That's really not what I'd expect at all. :(  
(This isn't to say it doesn't make sense semantically, but I 
don't like how it feels.)

> I'm thinking I'll change the name byInputRange to byWindow, and 
> add a byElement for an element-wise input range.
>
Oh, I see.  Naming.  Naming is hard.

-Wyatt


More information about the Digitalmars-d mailing list