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

Coroutines section #42

Merged
merged 18 commits into from
Mar 6, 2023
Merged

Coroutines section #42

merged 18 commits into from
Mar 6, 2023

Conversation

serras
Copy link
Member

@serras serras commented Feb 27, 2023

  • High-level concurrency
    • Flows
  • Resources (in progress)
  • STM (copied and edited from the current docs)
  • Concurrency primitives (stub)

@serras serras self-assigned this Feb 27, 2023
@serras
Copy link
Member Author

serras commented Feb 27, 2023

I think it's easier if we work on the whole section in a single PR.

The Resources section is now half-edited, copied from the current docs. My aim is to heavily edit it, so take it with a grain of salt right now.

@nomisRev could you take care of the section about Raise in combination with high-level concurrency? I didn't know what to say there exactly.

@nomisRev
Copy link
Member

Yes, I can take care of that ☺️ Shall I work directly in this PR?

@serras
Copy link
Member Author

serras commented Feb 27, 2023

Yes, I think that would be the most productive way of working.

Copy link
Member

@nomisRev nomisRev left a comment

Choose a reason for hiding this comment

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

Great docs so far @serras 🙌 Awesome work 😍

Some comments or questions, and I think we should add KotlinX Knit, and assertions.

content/learn/coroutines/concurrency-primitives.md Outdated Show resolved Hide resolved
content/learn/coroutines/parallel.md Outdated Show resolved Hide resolved
content/learn/coroutines/parallel.md Outdated Show resolved Hide resolved
content/learn/coroutines/parallel.md Outdated Show resolved Hide resolved
content/learn/coroutines/parallel.md Outdated Show resolved Hide resolved
content/learn/coroutines/stm.md Outdated Show resolved Hide resolved
content/learn/coroutines/stm.md Outdated Show resolved Hide resolved
content/learn/coroutines/stm.md Outdated Show resolved Hide resolved
content/learn/coroutines/stm.md Outdated Show resolved Hide resolved
content/learn/coroutines/stm.md Outdated Show resolved Hide resolved
@nomisRev
Copy link
Member

@serras found quite some broken code after adding KotlinX Knit, we should really keep up with adding KotlinX Knit everywhere or I'm afraid we'll end up with a lot of broken/incorrect snippets over time.

Not sure if you skipped it because it's still [DRAFT], but from experience I found it easier to do right away than to catch up with it afterwards.

@serras
Copy link
Member Author

serras commented Feb 28, 2023

@serras found quite some broken code after adding KotlinX Knit, we should really keep up with adding KotlinX Knit everywhere or I'm afraid we'll end up with a lot of broken/incorrect snippets over time.

Not sure if you skipped it because it's still [DRAFT], but from experience I found it easier to do right away than to catch up with it afterwards.

I wasn't really aware of Knit here. I certainly agree with you, it's easier to do it on the go than afterwards. I'll keep it on my work cycle from now on.

content/learn/coroutines/resource-safety.md Outdated Show resolved Hide resolved
content/learn/coroutines/resource-safety.md Outdated Show resolved Hide resolved
content/learn/coroutines/resource-safety.md Outdated Show resolved Hide resolved
Comment on lines 251 to 258
The actual magic is that `Resource` is nothing more than a type alias for
parameter-less function using `ResourceScope`,

```kotlin
typealias Resource<A> = suspend ResourceScope.() -> A
```

:::
Copy link
Member

Choose a reason for hiding this comment

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

❤️ We need to include such an :::info block for Effect as well explaining it's just an typealias for a receiver lambda.

@nomisRev nomisRev self-assigned this Mar 2, 2023
return the same type, and we don't care which one "wins", we conflate both into
a single value.

## Integration with typed errors
Copy link
Member

@nomisRev nomisRev Mar 2, 2023

Choose a reason for hiding this comment

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

I'm not quite happy with the examples I used here.. I hope to figure out something better while working on the KotlinConf workshop.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm merging, but I'm opening an issue so that we don't forget about this.

@serras serras changed the title [DRAFT] Coroutines section Coroutines section Mar 3, 2023
@serras
Copy link
Member Author

serras commented Mar 3, 2023

I've agreed with @nomisRev to first create a stub for concurrency primitives, which we could later expand. So this section is ready for review.

@serras serras merged commit bdb1b2f into main Mar 6, 2023
@serras serras deleted the coroutines branch March 6, 2023 09:23
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.

None yet

2 participants