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

API: Rename QuestionMarkExpr -> TryExpr (Breaking change) #241

Merged
merged 2 commits into from
Sep 12, 2023

Conversation

xFrednet
Copy link
Member

The ? operator is officially called the ErrorPropagationExpression in Rust's grammar. However, I've rarely seen people actually call it by that name. Even the documentation doesn't call it that after the grammar definition.

Before, I've called it the QuestionMarkOperator, but this name feels a bit off, as that describes how it's written, but not what it does. I have the impression, that the community commonly calls this operator the Try operator. That's at least the name I would use and what I've seen in a few blog posts.

This change is open for discussion. If you have any thoughts, please share them! :)

The `?` operator is officially called the *ErrorPropagationExpression* in [Rust's grammar](https://doc.rust-lang.org/reference/expressions/operator-expr.html#the-question-mark-operator). However, I've rarely seen people actually call it by that name. Even the documentation doesn't call it that after the grammar definition.

Before, I've called it the *QuestionMarkOperator*, but this name feels a bit off, as that describes how it's written, but not what it does. I have the impression, that the community commonly calls this operator the *Try* operator. That's at least the name I would use and what I've seen in a few blog posts.

This change is open for discussion. If you have any thoughts, please share them! :)
@xFrednet xFrednet added A-api Area: Stable API S-waiting-on-review Status: Awaiting review C-discussion Category: Discussion / Design decision. See also rust-marker/design labels Sep 11, 2023
@xFrednet xFrednet added this to the v0.3.0 milestone Sep 11, 2023
@jhpratt
Copy link
Member

jhpratt commented Sep 12, 2023

Given that there is an unstable Try trait that it desugared to, that name seems reasonable.

marker_api/src/ast/expr.rs Outdated Show resolved Hide resolved
@xFrednet xFrednet added this pull request to the merge queue Sep 12, 2023
Merged via the queue into rust-marker:master with commit 44d848a Sep 12, 2023
14 checks passed
@xFrednet xFrednet deleted the 052-expressions-question-mark branch September 12, 2023 19:02
@xFrednet xFrednet added the I-api-break Issue: This change will break the public API label Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-api Area: Stable API C-discussion Category: Discussion / Design decision. See also rust-marker/design I-api-break Issue: This change will break the public API S-waiting-on-review Status: Awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants