-
Notifications
You must be signed in to change notification settings - Fork 89
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
Please change syntax to be more noticeable #505
Comments
I don't understand this. Functions never return immediately. If you make an inter-canister call, it won't return until the function finishes. The behavior is exactly the same for async functions. You may be referring to making update calls from the agent side. In that case, it's up to the caller to decide if you want to call the endpoints asynchronously or synchronously. If calling asynchronously, it yields the control, and the agent has to poll to get the result, and you won't get the result until the function returns. If calling synchronously, it waits until the functions returns. Again, this is entirely up to the caller to decide how they want to make the call, it has nothing to do with the canister endpoints. |
In Motoko, there are sync methods like this: public shared func inc() : () { /*...*/ }; (note no It apparently translates to Rust as: #[update]
func inc() { /*...*/ }; (note no
This is unrelated. |
No, this is equivalent to |
I request it to be implemented. |
Please, change the syntax from
to
Give a warning if used old syntax.
This is because the first syntax deviates from the usual meaning of Rust functions (usual Rust functions never return before their body has finished executing) and can be too easily confused by a user with an
async
#[update]
(or#[query]
) function. This is just too much error-prone and the programmer needs to see that the function returns before its execution.The current practice deviates from the sound Rust practice to be a reliable programming language.
The text was updated successfully, but these errors were encountered: