Updates to member access (#7697)

Update the rules for member access:
-   Simple member access `a.b`
- If `a` names a scope, performs name lookup and optionally `impl`
lookup.
- Otherwise, `a.b` is shorthand for `a.(typeof(a).b)` and always
performs instance binding.
- Compound member access `a.(m)` does optional `impl` lookup and always
performs instance binding.
- This is a change from only performing instance binding if `m` is an
instance member.
- New operation `a.impl(m)` is introduced. It always performs `impl`
lookup, and nothing else.
- The `BindToType` interface is removed. Only instance binding may be
customized (using the `BindToValue` and `BindToRef` interfaces).

As a result, member access doesn't use whether the right operand is an
instance member anymore. Instead, instance binding is performed whenever
it would be plausible, and a new syntax is used to opt out.

Assisted-by: Gemini via Antigravity

---------

Co-authored-by: Josh L <josh11b@users.noreply.github.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
josh11b
2026-09-15 00:03:41 +00:00
committed by GitHub
co-authored by Josh L Richard Smith
parent cf66fb8aeb
commit db2e26ba86
2 changed files with 614 additions and 5 deletions
+7 -5
View File
@@ -34,12 +34,14 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
## Overview
> **TODO:** >
> **TODO:**
> [#3720: Member binding operators](/proposals/p003720-member-binding-operators.md)
> introduces an additional "member binding" step, redefines simple member access
> in terms of compound member access, and defines compound member access in
> terms of calls to user-implementable interface methods. This document must be
> updated to reflect those changes.
> and
> [#7697: Updates to member access](/proposals/p007697-updates-to-member-access.md)
> redefine simple member access in terms of compound member access, define
> instance binding in terms of calls to user-implementable interface methods,
> and add another member access form `x.impl(M)`. This document must be updated
> to reflect those changes.
A _qualified name_ is a [word](../lexical_conventions/words.md) that is preceded
by a period or a rightward arrow. The name is found within a contextually