Creating this topic to catch any typos and bugs in the 2nd Edition of Kotlin Coroutines by Tutorials.
Hi! The “BroadcastChannelOpenSubscriptionExample” example for chapter 12 doesn’t appear to produce the expected output. The output given in the book is:
Press a key to exit... Consumer 2: Grapes Consumer 1: Grapes Consumer 2: Strawberry Consumer 1: Strawberry
but the actual output I’m getting is just:
Press a key to exit...
Really enjoying the book so far though, thanks!
@nisrulz Can you please help with this when you get a chance? Thank you - much appreciated! :]
Chapter 4, Page 78 under the heading “Handling the continuation”
This paragraph starts with, “In the last version of getUser(), you used suspendCoroutine() from the Coroutines API.”
This is not true. The last version simply had us mark a function with the ‘suspend’ keyword. The function at the time was called ‘getUserSuspend()’
This paragraph is probably confusing the information given on page 75 where a hypothetical solution is offered for migrating to coroutines with functions that belong to an API for which we do not have control over. It was for a fictional function
fun readFile(path:String, onReady: (File) -> Unit)
The paragraph on page 78 gets confusing because it goes on to explain the intricacies of suspendCoroutine() which we have not actually put to practice yet.
@filbabic Can you please help with this when you get a chance? Thank you - much appreciated! :]
Thanks for pointing this out!
You’re right, it gets a bit confusing because there are different functions involved, and the hypothetical solution is there to paint a picture of what you can do with coroutines & suspend functions.
We have this under the radar, and will change it up to make it more sensible, in the next edition of the book! :]