Stream: t-libs

Topic: io2


Simon Sapin (Jan 09 2020 at 10:13, on Zulip):

I’ve been idly wondering if it would be worth introducing entirely new Read and Write traits, leaving the existing one alone in order to more easily make changes that are tricky to do backward-compatibly. Those changes include soundly reading into an uninitialized slice (cc @Steven Fackler), existing in libcore (so not requiring std::io::Error which requires Box and errno), and perhaps others. These new APIs could live in an io2 module (std::io2 and core::io2).

Simon Sapin (Jan 09 2020 at 10:13, on Zulip):

(I am however not volunteering to champion such a proposal.)

Steven Fackler (Jan 09 2020 at 13:41, on Zulip):

That definitely is an option, but it'd be so disruptive that I think we'd need a really good reason to do it. The uninitialized buffer stuff can be added in a pretty clean way to the existing trait so I don't know if it's worth it.

Simon Sapin (Jan 09 2020 at 13:44, on Zulip):

It would indeed be disruptive and probably no individual change alone is worth that. But maybe together?

Lokathor (Jan 09 2020 at 18:17, on Zulip):

Having read and write traits in core is a very good thing.

Lokathor (Jan 09 2020 at 18:17, on Zulip):

they don't need to be complete replacements for existing read and write though

Lokathor (Jan 09 2020 at 18:18, on Zulip):

an ideal situation would be if a subset of current read/write could be extracted and put in a sub trait in core, and then std read and write extend that with all the stuff

Lokathor (Jan 09 2020 at 18:19, on Zulip):

and all that would be totally orthogonal to adding new methods for uninit memory or not

Simon Sapin (Jan 09 2020 at 18:34, on Zulip):

an ideal situation would be if a subset of current read/write could be extracted and put in a sub trait in core

But they can’t, because std::io::Error.

Lokathor (Jan 09 2020 at 18:37, on Zulip):

well, then i guess we'll need io2 eventually

Steven Fackler (Jan 09 2020 at 18:54, on Zulip):

or a merge of core and std

Lokathor (Jan 09 2020 at 20:08, on Zulip):

Maybe.

std error needs to be in std because of having os awareness and possible allocating and such, but the point of having core reading and writing is to make your code be totally agnostic to things like that, and even support no OS and no allocation.

Last update: Jul 02 2020 at 13:50UTC