-
Couldn't load subscription status.
- Fork 1.4k
Update Migration Guide: Unsafe Marker #6972
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
Conversation
| > Note: | ||
| > | ||
| > In ZIO 2.x, the `ZIO#provide` method—together with its variant `ZIO#provideSome`—is a default and easier way of injecting dependencies to the environmental effect. We do not require creating the dependency graph manually, it will be automatically generated. In contrast, the `ZIO#provideLayer`—and its variant `ZIO#provideSomeLayer`—is useful for low-level and custom cases like. | ||
| > In ZIO 2.x, the `ZIO#provide` method—and all its variants `ZIO#provideSome`, `ZIO#provideCustom`—is a default and easier way of injecting dependencies to the environmental effect. We do not require creating the dependency graph manually, it will be automatically generated. In contrast, the `ZIO#provideLayer`—and all its variants `ZIO#provideSomeLayer`, `ZIO#provideCustomLayer`—is useful for low-level and custom cases like. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an unnecessary change. There was another PR that we merged to delete references to provideCustom since it was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird change! Wondering how it comes to my commits :)
Fixed!
|
|
||
| In ZIO 1.x, we used the `zio.Runtime.unsafeRun` method to run a ZIO workflow: | ||
|
|
||
| ```scala |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to use mdoc on these examples where possible so we test that they compile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but some of them are based on ZIO 1.x, one of them is just a diff snippet based on ZIO 2.x, some of them are just simplified definitions of the API, and one another is based on scala 3. All of these are not type-safe.
Fortunately, the final snippet has a type-safe mdoc modifier.
|
|
||
| For example, if we wanted to integrate a ZIO workflow with a legacy unsafe code, we used to write something like this: | ||
|
|
||
| ```scala |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to do the migration table for Runtime.unsafe*** here or in a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just a few comments.
|
|
||
| | | ZIO 1.0 | ZIO 2.x | | ||
| |---------|----------------------------|-------------------------------------------------------------| | ||
| | Scala 2 | `zio.Runtime.unsafeRun(x)` | `Unsafe.unsafe{ implicit u => zio.Runtime.unsafe.run(x) }` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khajavi Would be good to add the other unsafeRun variants from ZIO 1.0 to this table.
No description provided.