Skip to content

[intro.execution] Missing definition for evaluations "associated with" an expression and sequencing between composite and constituent evaluations #959

Description

@xmh0511

Full name of submitter (unless configured in github; will be published with the issue): Jim X

[intro.execution] p8 and p9 use the wording

every value computation and every side effect associated with the expression/full-expression

However, the standard does not formally define what evaluations are considered "associated with" a given expression. Furthermore, it lacks a fundamental rule regarding whether a composite evaluation (referred to as a whole) can be sequenced with respect to its own constituent evaluations.

Consider the following example using the comma operator:

int main() {
  int a = 0, b = 1;
  (a, b); // #1
}

When we refer to the evaluation of the expression (a, b) at #1 as a whole, let's name this composite evaluation $E$. Intuitively, $E$ contains several sub-evaluations (which are the evaluations "associated with" $E$). Let:

  • $A$ be the evaluation of the left operand a.
  • $B$ be the evaluation of the right operand b.
  • $R$ be the value computation of the result of the comma operator itself.

[expr.comma] p1 specifies:

The left expression is sequenced before the right expression ([intro.execution]).

That is, $A$ is sequenced before $B$

[intro.execution] p10:

The value computations of the operands of an operator are sequenced before the value computation of the result of the operator.

This rule successfully sequences both $A$ and $B$ before $R$.

These rules work perfectly and logically because $A$, $B$, and $R$ are mutually disjoint (non-overlapping) constituent evaluations within the overall evaluation $E$. This implies the standard implicitly assumes that sub-evaluations can be ordered as long as they do not overlap.

However, a topological ambiguity arises when we consider the relationship between $E$ (the whole) and its parts (e.g., $A$, $B$, or $R$). Because $R$ is an evaluation "associated with" (or contained within) $E$, can $E$ be sequenced with respect to $R$?

Since "sequenced before" is an asymmetric, strict partial order, a composite whole cannot logically be ordered before or after its own parts. Yet, the standard currently lacks a rule stating that a composite evaluation cannot be sequenced with its constituent evaluations. It simply relies on the reader's intuition that sequencing relations only apply between disjoint evaluations. Without a formal definition of "associated with", the boundaries of what constitutes the "whole" remain ambiguous.

Suggested Resolution:

  1. Formalize "associated with": Explicitly define that the evaluations "associated with" an expression include its own value computation, its side effects, and recursively all evaluations associated with its subexpressions.
  2. Clarify Whole-Part Sequencing: Add a normative note or rule stating that the "sequenced before" relation only applies to mutually disjoint (non-overlapping) evaluations. A containing evaluation is neither sequenced before nor sequenced after any of its constituent evaluations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions