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

Add an annotation to mark function or class as forkable #871

Open
flaksp opened this issue Jul 19, 2023 · 0 comments
Open

Add an annotation to mark function or class as forkable #871

flaksp opened this issue Jul 19, 2023 · 0 comments
Labels
compiler Feature related to compiler runtime Feature related to runtime

Comments

@flaksp
Copy link

flaksp commented Jul 19, 2023

Sometimes wrapping a code with fork() may produce a compiler error that asks to "simplify" code inside the forked function.

It would be nice to have an annotation like @kphp-forkable that can be used above classes or functions to make sure the compiler will always check them for being forkable even if there are no actual fork() invocations for these functions.

This may help in following scenario:

  1. I create simple merge request that introduces new repository (which sends RPC requests under the hood). For this task I don't need some forks because this task is pretty simple. That's why I don't care about forks here.
  2. Then I create another merge request with more complex logic, and I need to fork() some method from the repository created in the previous merge request. In this case I need to refactor the repository to make sure code is "simple" enough to be forked.

If I had an annotation then unnecessary refactoring in the 2nd merge request may be avoided. Because when I was developing the repository in the 1st merge requests I could predict in advance that the repository may be forked by somebody in the future because it's an abstraction over network operation (RPC request).

@Tsygankov-Slava Tsygankov-Slava added runtime Feature related to runtime compiler Feature related to compiler labels Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Feature related to compiler runtime Feature related to runtime
Projects
None yet
Development

No branches or pull requests

2 participants