8000 Consider deprecating `ZIO#onDone` · Issue #9191 · zio/zio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Consider deprecating ZIO#onDone #9191
Closed
@kyri-petrou

Description

@kyri-petrou

I was debugging a nasty bug at $WORK, and to my surprise I found out that ZIO#onDone forks the effect and "discards" the fiber, running the success/error callbacks on exit (see here)

I think this behaviour is quite dangerous because its behaviour is very different than other onX methods (e.g., onExit). As a user (or in my case, when I reviewed the PR that caused the bug), I won't know that the method forks the effect and doesn't await on its completion unless I take a look at the source code.

In order to guard against incorrect usage of this method, we should consider deprecating it (onDoneCause as well). If we find out that users do use this method in the correct way and need it, we can introduce it under a more accurate name (forkDaemonExit or something)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0