Skip to content

GenServer: Rename continue argument in handle_continue/2 #11793

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

Merged

Conversation

eksperimental
Copy link
Contributor

As I was reading the docs, it was not clear what the continue argument
was just by reading its name.

handle_call and handle_cast use request for a similar argument,
so I unified it.

@eksperimental eksperimental force-pushed the genserver_handle_continue branch from bfdf593 to d75ac46 Compare May 2, 2022 05:20
Copy link
Contributor

@anildigital anildigital left a comment

Choose a reason for hiding this comment

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

Looks fine to me

@whatyouhide
Copy link
Member

If we're going back to revisit this, I would make the case that request doesn't represent what's going on here. The GenServer is not making a "request" to itself. It's passing a term to be used in the continuation. I think these words might convey the meaning better:

  • context — we're passing the "context" necessary to continue
  • continue_term — not the prettiest, but conveys the meaning 😄

Thoughts?

@josevalim
Copy link
Member

Let’s call it continue_arg then?

@whatyouhide
Copy link
Member

whatyouhide commented May 2, 2022

@josevalim yes that's great for me too. continue_arg it is!

@eksperimental
Copy link
Contributor Author

The other expression that was used before this PR was instruction.

@eksperimental
Copy link
Contributor Author

So the possible names that I see are instruction, continue_instruction or continue_arg.

I'm in favor of continue_instruction, as I think it is more descriptive than continue_arg.

@josevalim
Copy link
Member

Id go with continue_arg or continue_argument.

@whatyouhide
Copy link
Member

Let's go with continue_arg @eksperimental, thanks! 💟

As I was reading the docs, it was not clear what the `continue` argument
was just by reading its name.
@eksperimental eksperimental force-pushed the genserver_handle_continue branch from d75ac46 to fa825a0 Compare May 3, 2022 13:21
| {:stop, reason :: term, new_state}
when new_state: term
when new_state: term, continue_arg: term
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm in doubt whether we can use the same variable for two continue_arg values that could be different.

Copy link
Member

Choose a reason for hiding this comment

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

We cannot but in this case they are the same. We can only return a continue_arg that handle_continue accepts.

@eksperimental
Copy link
Contributor Author

The PR is ready for reviewing.

@josevalim josevalim merged commit 122cc00 into elixir-lang:main May 8, 2022
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@eksperimental eksperimental deleted the genserver_handle_continue branch May 8, 2022 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants