Skip to content

Need a Definition for the Term “receiver” #364

@RexJaeschke

Description

@RexJaeschke

I’m working on a future proposal, and it refers to “receiver,” a term with which I was not previously familiar. A look through the current spec base shows uses of this term, but no definition. Those uses are:

classes.md:

15.6.10 Extension methods

An extension method is a regular static method. In addition, where its enclosing static class is in scope, an extension method may be invoked using instance method invocation syntax (§12.7.6.3), using the receiver expression as the first argument.

expressions.md:

12.3 Static and Dynamic Binding|12.3.1 General

Binding is the process of determining what an operation refers to, based on the type or value of expressions (arguments, operands, receivers). For instance, the binding of a method call is determined based on the type of the receiver and arguments. The binding of an operator is determined based on the type of its operands.

12.3.4 Types of subexpressions

When an operation is statically bound, the type of a subexpression (e.g., a receiver, and argument, an index or an operand) is always considered to be the compile-time type of that expression.

12.6.2.2 Corresponding parameters

For virtual methods and indexers defined in classes, the parameter list is picked from the first declaration or override of the function member found when starting with the static type of the receiver, and searching through its base classes.

12.6.5 Compile-time checking of dynamic member invocation

  • For an indexer access (§12.7.7.3) the set of accessible indexers in the receiver is known at compile-time.
  • If F is a static method, the method group shall not have resulted from a member_access whose receiver is known at compile-time to be a variable or value.
  • If F is an instance method, the method group shall not have resulted from a member_access whose receiver is known at compile-time to be a type.

12.7.6 Invocation expressions|12.7.6.1 General

  • Otherwise, the result is a value, with an associated type of the return type of the method or delegate after any type argument substitutions (§12.7.6.2) have been performed. If the invocation is of an instance method, and the receiver is of a class type T, the associated type is picked from the first declaration or override of the method found when starting with T and searching through its base classes.

12.16.5 Anonymous functions and dynamic binding

An anonymous function cannot be a receiver, argument, or operand of a dynamically bound operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolved: by-designThe issue was examined, and we decided it wasn't a problem after alltype: clarityWhile not technically incorrect, the Standard is potentially confusing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions