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

Minor Improvements to the documentation and code comments #4346

Open
wants to merge 38 commits into
base: master
Choose a base branch
from

Conversation

jamhour1g
Copy link

@jamhour1g jamhour1g commented Feb 9, 2025

This pull request improves the documentation and code comments in the repository.

The changes include:

  • Clarifications and corrections in the cancellation-and-timeouts.md document.
  • Enhanced explanations and added references in composing-suspending-functions.md.
  • Improved readability and structure in coroutine-context-and-dispatchers.md.
  • Various grammatical and stylistic improvements across multiple documentation files.
  • Code comments updated for better clarity and accuracy in CompletableJob.kt, CoroutineScope.kt, Job.kt, Supervisor.kt, Yield.kt, and ThreadContextElement.kt.

Refined the wording for better readability and correctness.
Added missing articles and restructured sentences to avoid
splitting the infinitive.
Corrected verb forms for grammatical accuracy.
Added missing commas for grammatical correctness.
Ensured proper separation between clauses to
enhance sentence flow.
…oaches

Refined the explanation of cancellable computation strategies for
greater clarity and precision.

- Expanded details on periodically invoking suspending functions.
- Reworded sentence structure to improve readability.
- Included explicit references to `ensureActive` to provide better guidance on checking cancellation status.
Revised grammatical inconsistencies for improved clarity and correctness.

- Changed `well-behaving` to `well-behaved` to use the correct past
  participle form in a compound adjective.
- Remove an unnecessary "a" from "any kind of a communication channel"
  to ensure proper usage.
…yling

Applied a note style to improve visibility and ensure that important
information stands out more clearly in the documentation.
…raction with coroutineScope example

- Improve readability of async and coroutineScope explanation
- Simplify language while maintaining technical accuracy
- Restructure sentence flow for better comprehension
…ext switching

Refined the explanation of coroutine context switching for better clarity
and comprehension.

- Expanded details on `runBlocking` with an explicit context to highlight
  its controlled execution benefits.
- Clarified how `withContext` suspends a coroutine and switches execution
  context while ensuring smooth reversion.
- Structured the explanation for improved readability and understanding.
Refined the documentation to enhance clarity and structure.

- Improved sentence flow and paragraph formatting for better readability.
- Reformatted explanations of job states and transitions for improved
  comprehension.
- Enhanced descriptions of cancellation behavior to clarify distinctions between normal cancellation and failure.
Refined the documentation for `completeExceptionally` to enhance clarity
and correctness.

- Improved sentence structure for better readability.
- Clarified the transition states of a job when completed exceptionally.
- Fixed grammatical inconsistencies, such as "its responsibility" →
  "It is the responsibility."
- Enhanced explanation of how children receive `CancellationException`
  for diagnostic purposes.
- Refined the explanation of `CoroutineScope` and its role in managing coroutine lifecycles.
- Adjusted phrasing to provide a smoother flow and better comprehension.
…ope()

Added missing articles for improved grammatical accuracy and readability.
Included a direct link to the `CoroutineScope()` function to enhance
navigation and accessibility for developers.
Expanded the explanation of `withContext` to provide a more precise
understanding of its behavior.

- Clarified that `withContext` only suspends and switches context if
  the specified context differs from the current one.
- Explained how `CoroutineDispatcher` influences context switching,
  requiring additional dispatches.
- Improved wording for better readability and comprehension.
…g coroutine execution

Revised phrasing to reflect that coroutines are continuously launched throughout the application's lifecycle.

- Changed "we launched" to "launching" to better align with present continuous tense, emphasizing ongoing behavior.
…s get cancelled

Added "All" to stress that every coroutine is cancelled, highlighting
this crucial aspect of coroutine behavior.
Corrected "a different threads" to "different threads" for grammatical
accuracy.
Restored emphasis on "whole application lifetime" to clearly indicate
that top-level coroutines span from application start to termination.
…tions

Reverted "or" to its original placement to correctly reflect that a job
remains active until either the coroutine completes or `CompletableJob.complete`
is called.
…uracy

Fixed an extra "on" left over after the change to ensure proper sentence
structure and readability.
…prove clarity

Revised the explanation of `runBlocking` to remove the ambiguous phrase "controlled environment" and improve clarity.

- Reworded the first technique to focus on specifying a context explicitly.
- Refined the explanation of `withContext` to emphasize its behavior when switching contexts.
Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb left a comment

Choose a reason for hiding this comment

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

Building the project fails now because of broken links in the documentation. You can run gradle knitCheck to confirm this.

@jamhour1g
Copy link
Author

Building the project fails now because of broken links in the documentation. You can run gradle knitCheck to confirm this.

@dkhalanskyjb All these issues are related to Kotlin Standard library functions, lazy and use. I am curious why Knit is unable to reference them. I would love to hear your thoughts on this. And how do I solve it? Do you think I should include explicit links?

Isn't the Kotlin Standard library implicitly included in all Kotlin projects? Shouldn't Knit be able to find the references?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants