Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use IOException provided by kotlinx-io #728

Merged
merged 2 commits into from
Aug 24, 2024
Merged

Use IOException provided by kotlinx-io #728

merged 2 commits into from
Aug 24, 2024

Conversation

twyatt
Copy link
Member

@twyatt twyatt commented Jul 30, 2024

This change comes with some tradeoffs:

One one hand, we get to leverage a widely used class signature for IOException, that consumers may already use — reducing overhead of having to keep Kable's (com.juul.kable.IOException) vs. kotlinx-io's (kotlinx.io.IOException) separate. In other words: it is a footgun for consumers that use kotlinx-io, as they may try to catch kotlinx.io.IOException when calling a Kable IO function (not realizing that com.juul.kable.IOException will slip right through that try-catch).

On the other hand, this pulls in a library purely for a single exception class (this would likely be justified if we started adding support for kotlinx-io features, e.g. Source, Sink, Buffer; but that is a long ways off, if ever).

Of further consideration: there is talk of moving some of these IO primitives to the standard library (Kotlin/kotlinx-io#354). It is unclear if that would include IOException — if IOException were moved to the standard library it would be a no brainer to use it.

@twyatt twyatt added the major Changes that should bump the MAJOR version number label Jul 30, 2024
@twyatt twyatt marked this pull request as ready for review July 30, 2024 21:33
@twyatt twyatt requested review from davertay-j and a team as code owners July 30, 2024 21:33
@twyatt twyatt requested a review from cedrickcooke July 30, 2024 21:33
@cedrickcooke
Copy link
Contributor

I don't think we should hesitate about including a large library and only using a subset of it. All 3 major KMP targets include dead code elimination in their release process (KMP handles it directly when building native/JS, and Android has it through R8)

Copy link
Contributor

@QuantumRand QuantumRand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually paves the way nicely to be able to add an optional kotlinx-io sub module that provides things like Sink, Source, and Buffer features.

@twyatt twyatt force-pushed the twyatt/IOException branch from 4337544 to ed4714c Compare July 31, 2024 19:17
@twyatt twyatt added this to the 0.35.0 milestone Aug 24, 2024
@twyatt twyatt enabled auto-merge (squash) August 24, 2024 03:53
@twyatt twyatt merged commit 0c6af25 into main Aug 24, 2024
2 checks passed
@twyatt twyatt deleted the twyatt/IOException branch August 24, 2024 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Changes that should bump the MAJOR version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants