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

define an execution environment's salient properties #328

Open
ericniebler opened this issue Feb 11, 2025 · 1 comment
Open

define an execution environment's salient properties #328

ericniebler opened this issue Feb 11, 2025 · 1 comment
Labels
bug Something isn't working P1

Comments

@ericniebler
Copy link
Collaborator

ericniebler commented Feb 11, 2025

The definitions of MAKE-ENV, JOIN-ENV, and FWD-ENV make them context-dependent; the pseudo-macros can expand to different expressions for the same arguments in different usage contexts. That's fine, but we don't discuss when one execution environment can be substituted with another in an equality-preserving way.

Functionally, any two environments are "equal" if they support the same queries with the same types and values. The type of the environment itself is immaterial; only the query expressions matter.

Proposed Resolution

Change [exec.query.general] as follows:

 33.2.1 General [exec.queryable.general]
 
 - 1. A queryable object is a read-only collection of key/value pair where each
      key is a customization point object known as a query object. A query is an
      invocation of a query object with a queryable object as its first argument
      and a (possibly empty) set of additional arguments. A query imposes
      syntactic and semantic requirements on its invocations.
 
 - 2. Let q be a query object, let args be a (possibly empty) pack of
      subexpressions, let env be a subexpression that refers to a queryable
      object o of type O, and let cenv be a subexpression referring to o such
      that decltype((cenv)) is const O&. The expression q(env, args...) is equal
      to ([concepts.equality]) the expression q(cenv, args...).
 
 - 3. The type of a query expression cannot be void.
 
 - 4. The expression q(env, args...) is equality-preserving ([concepts.equality])
      and does not modify the query object or the arguments.

+- ?. The type of a queryable object is a queryable type. Let A and B be two
+     queryable types. A and B are considered equivalent if, given two objects
+     a and b of types A and B respectively and any query object q, either
+     both expressions a.query(q) and b.query(q) are ill-formed, or else they
+     are both well-formed and have the same type. Objects a and b are equal
+     ([concepts.equality]) if queryable types A and B are equivalent and if
+     for any query object q the expressions a.query(q) and b.query(q) yield the
+     same value if they are well-formed.

 - 5. If the expression env.query(q, args...) is well-formed, then it is
      expression-equivalent to q(env, args...).

 - 6. Unless otherwise specified, the result of a query is valid as long as the
      queryable object is valid.

In [exec.getcomplsigs], insert a new paragraph between paragraphs 2 and 3 that
reads:

+- ?. Let Env1 and Env2 be two equivalent queryable types ([exec.query.general]),
+     and let Sndr be a sender type. If completion_signatures_of_t<Sndr, Env1>
+     satisfies valid-completion-signatures, then completion_signatures_of_t<Sndr, Env2>
+     shall denote the same type, and vice versa.
@ericniebler ericniebler added bug Something isn't working P1 labels Feb 11, 2025
@ericniebler
Copy link
Collaborator Author

This change is motivated by LWG#4203, which requires that equal environments of different types are substitutable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1
Projects
None yet
Development

No branches or pull requests

1 participant