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

[expr.mptr.oper] Change the term "function call operator" to "function call operator function" or define the term "function call operator" separately and same for other operators like subscript operator #618

Open
ranaanoop opened this issue Oct 2, 2024 · 0 comments

Comments

@ranaanoop
Copy link

Full name of submitter : Anoop Rana

Reference (section label):

Link to reflector thread (if any): https://stackoverflow.com/questions/79039587/is-subscripting-or-a-conditional-syntactically-an-operator and CWG189.

Issue description:

Currently the c++ standard does not technically define the term(s) "function call operator" or "subscript operator", though it uses the term "function call operator" more than 20 times in the draft. Instead it defines the terms like "function call expression" and "subscript expression". Moreover, currently the standard uses the terms "square brackets" and "parentheses" while describing these "expressions". But we don't have any definition for their corresponding "operator"s.

The closest example we have for the term "function call operator" is in expr.mptr.oper:

If the result of .* or ->* is a function, then that result can be used only as the operand for the function call operator ().

Note that "operator" in the above quoted reference [expr.mptr.oper] is not italicized in the standard. So the above quoted reference seem to imply that () is to be considered as the "function call operator".

Except than this [expr.mptr.oper], we don't have any definition for "function call operator". Similarly, we don't have any definition for the term "subscript operator". Same goes for "conditional operator". We do have [expr.cond] but that really only defines "conditional expression" but does not say anything like ?: is to be called the "conditional operator".


Now, coming to the second issue. The standard uses the term "function call operator" at many places(more than 20) and it seems what it really means there is "function call operator function". For example, in expr.prim.lambda.closure we have:

The closure type for a non-generic lambda-expression with no lambda-capture and no explicit object parameter ([dcl.fct]) whose constraints (if any) are satisfied has a conversion function to pointer to function with C++ language linkage having the same parameter and return types as the closure type's function call operator.

Note the emphasis on "function call operator" which is intended to mean "function call operator function" afaik in the above quoted reference. So it would be better if we just change that term to "function call operator function"(as currently there is no official definition of the term "function call operator" and nowhere in standard it is said that it is meant to be the same as "function call operator function").

But note that we need to be careful when changing the term "function call operator" to "function call operator function". For example, in expr.mptr.oper the term "function call operator" does mean "function call operator function". Instead it means ().

If the result of .* or ->* is a function, then that result can be used only as the operand for the function call operator ().

So we have one example, where the term "function call operator" doesn't mean "function call operator function" but instead means ().

So I think it would be better if the "operator"s were given official definition in the standard and also that the references to "function call operator" be fixed wherever needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant