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

Support optional receive action #1284

Open
jclark opened this issue Jan 5, 2024 · 1 comment
Open

Support optional receive action #1284

jclark opened this issue Jan 5, 2024 · 1 comment
Labels
Area/Lang Relates to the Ballerina language specification Type/Improvement Enhancement to language design

Comments

@jclark
Copy link
Collaborator

jclark commented Jan 5, 2024

With conditional sends #1273, we maybe need the concept of an optional receive action.

The idea would be that if there is no message to receive, instead of the result being an error, the result is nil. This is for the case where the user knows that it is possible for there to be no message (perhaps from merging two things where the existence of one might depend on something in the message).

This is analogous to how m["x"] produces nil in the case where a m m has no field "x". Just as in this case, if the compiler determines that there will always be a message receivable, then nil would not be in the type of the expression.

A tool that generated a dataflow graph might generate optional receive actions by default.

@hasithaa
Copy link
Contributor

hasithaa commented Jan 5, 2024

@anupama-pathirage anupama-pathirage added Type/Improvement Enhancement to language design Area/Lang Relates to the Ballerina language specification labels Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Lang Relates to the Ballerina language specification Type/Improvement Enhancement to language design
Projects
None yet
Development

No branches or pull requests

3 participants