First time using <kotlinx.io> today and I was a bi...
# io
r
First time using kotlinx.io today and I was a bit thrown that
kotlinx.io.asSource
returns a
RawSource
, which is not a
Source
. Have you considered renaming it to
kotlinx.io.asRawSource
, and making
kotlinx.io.asSource
syntactic sugar for
.asRawSource().buffered()
?
(Same questions for
asSink
, of course)
f
Hey! Thanks for pointing to this. I don't think we ever discussed possible confusion caused by the fact that
asSource
returns
RawSource
. The return type was chosen as a more universal one, and the name as a nicer one. And there is no function returning
Source
as it seems trivial to construct it. It might be worth giving it a second thought before stabilizing the library.
r
It might be that the 3rd party library's API was being too restrictive in wanting a
Source
rather than a
RawSource
? Not sure what best practice is there.
f
It all depends. I think it is fine to accept
Source
and
Sink
instead of their Raw ancestors. And from that perspective it makes more sense to provide extensions that return these buffered types directly, without a need to call
.buffered()
on them.