Following the previous evidence that rust loves sea creature (see Ferris the crab, and turbofish), we should continue this theme and name this operator with another of this kind. Afterall, we know that salty water makes metals rust faster (pun intended).
Squeel Operator
From squeal + eel. Here a picture to depict this operator
It resembles question mark (see picture above), just like ::<> resembles fish
It makes sense to give a name to ::<> since “colon colon less than greater than” is a mouthful. But in the case of ?, you’re not just proposing a name, you’re proposing to rename it. Why call it anything other than “question mark” or “question mark operator”?
Since panics are not exceptions, and ? does not throw or panic or call unwrap(), if we decide we want a name that describes what it does I think “early return” operator would be much better than “throw” or “unwrap” operator.
But overall I agree with @jimrybarski: There already is an obvious name of “question mark operator”, unlike with the turbofish, so we might as well stick with that.
I like “try” better than “question mark” because it’s related to what the operator does, rather than what it looks like. Just like * is not called an asterisk operator, nor & an ampersand operator.
The Carrier documentation already refers to it as the question mark operator. It’s kinda like a panicless trow. “early return” is apt but it only as long as we don’t have the catch block. Sort of a “break on Err/error”
Yeah I see nothing wrong with “the question mark operator”. It’s not like “the double colon angle brackets operator” or Python’s “underscore underscore init underscore underscore” (which still doesn’t seem to have a good name). It’s pretty simple to say “the question mark operator”.
I’m against QuestionMark for the operator name.
It’s inconsistent with the names for other operators, e.g. Not,Add, Div instead of ExclamationMark, Plus, Minus.
They all have been given names for their intended uses instead of the literal name of the symbol.
Also if, in the future of Rust, we want to add another operator that also uses ? somehow in a different context, then the name “question mark” would carry meaning for two different operators.
Note that this is already the case: * is both used for Mul and Deref, - is both used for Sub and Neg.
Seeing as ? replaces the try! macro, Try seems to me a sensible choice. Or at the very least, some name that makes its intended use obvious.