Skip to content

Conversation

@fzhinkin
Copy link
Collaborator

Closes #448

@MohammadKHC
Copy link

Hmm @fzhinkin will this get merged soon?

@fzhinkin fzhinkin force-pushed the 448-system-line-separator branch from d878fa0 to 4a8e612 Compare December 17, 2025 15:39
@fzhinkin fzhinkin marked this pull request as ready for review December 17, 2025 16:04
@fzhinkin fzhinkin requested a review from shanshin December 17, 2025 16:05
try {
os.EOL
} catch (_: Throwable) {
"\r\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it somehow justified that we use \r\n as a fallback?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

HTML uses CRLF as a line separator, so I thought it's a good idea to fall back to it. But it has to be explicitly specified.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, wait, it's already documented and says that the separator is different :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JSMonk does such a choice make any sense? Or it's better to use \n?

package kotlinx.io

/**
* Sequence of characters used as a line separator by the underlying platform.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it's better to explicitly write about it in a specific platform, like:
Sequence of characters used as a line separator in Apple targets?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would prefer having the same brief kdoc line across all actualizations, and only add platform specific details in the expanded version of a doc. But that's a personal preference, I don't have strong arguments to support it (docs will be different anyway). So we can try your suggestion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Depending on the target, I tend to end the phrase "Sequence of characters used as a line separator ... " with:

  • "... in JS environments"
  • "... by Windows"
  • "... on Apple targets"
  • "... by Unix platforms"
  • "... by the JVM"

WDYT? The lack of consistency bugs me, and writing "on XXX targets" everywhere feels off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants