std.Stream.InputStream convenience functions

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 4 23:15:15 PDT 2015


On Friday, 4 September 2015 at 22:36:01 UTC, bitwise wrote:
> On Friday, 4 September 2015 at 14:40:43 UTC, Jonathan M Davis 
> wrote:
>> On Friday, 4 September 2015 at 00:05:06 UTC, bitwise wrote:
>>> Thoughts?
>>
>> std.stream is on the chopping block and has been for years, 
>> and it was decided at dconf that we'd actually get rid of it 
>> now rather than just have it say in the documentation that 
>> it's going away. As I understand it, the only reason that it 
>> wasn't deprecated in 2.068 was because of some sort of issue 
>> with the PR that forced it to be delayed. But there's no point 
>> in making any improvements to it, because that code is not 
>> going to be around for much longer.
>>
>> - Jonathan M Davis
>
> Wow...this is surprising. At first glance, the streams seemed 
> to be fairly well done. What's the reason for them being 
> removed? and what is meant to be the replacement?

It's old (from D1) and does not follow the current best practices 
or idioms. If we're going to have a stream solution, it needs to 
be range-based. That being said, ranges in and of themselves get 
pretty close to streams, and there simply hasn't been a push to 
come up with a range-based stream solution where the pieces that 
aren't already part of ranges are taken care of. std.stream has 
been marked as scheduled for deprecation for years, and no one 
has bothered to replace it. It comes up periodically, but no one 
seems to care enough to do anything about it. So, rather than 
leave it in that state, we decided that it would be better off to 
just deprecate it and then get rid of it rather than leave it in 
limbo with the documentation saying that it's not up to our 
standards and that we're going to get rid of it at some point. At 
some point, someone may come up with a range-based stream 
solution and get it into Phobos, but until then, we'll just use 
straight up ranges, which come close enough for most cases. 
std.stdio and std.mmfile make it quite possible to operate on 
files with ranges in a manner similar to streams, and std.stdio 
allows you to operate on stdin and stdout in a similar manner 
(since they're std.stdio.Files).

That being said, std.stream is boost-licensed, and anyone is free 
to copy it or fork it so long as the copyright notice is left on 
it. So, anyone who wants to use std.stream in their own code even 
after it's no longer in Phobos is free to do so. It's just that 
the std.stream code is then going to have to be part of their 
project rather than Phobos.

- Jonathan M Davis


More information about the Digitalmars-d mailing list