liveBook · Manning

Receiver

A receiver is an entity or value designated to accept a message, signal, or operation.

How 3 Manning books explain it

The Well-Grounded Rubyist, Fourth Edition

An explicit receiver is the object written before the dot in a Ruby method call.

How it is used
Identifies which object receives a Ruby method call, including calls that rely on `self` instead of an explicit object.
How deep it goes
Explains explicit and default receivers through method-call syntax and worked class and instance examples, without descending into method-dispatch internals.
Examples
Uses string conversion, calls between instance methods, a composed name, and array-combining operations.
What you can do after
Diagnose/debug with it by identifying the object a call targets and distinguishing changes to an array receiver from variable reassignment.

Read how The Well-Grounded Rubyist, Fourth Edition explains receiver →

Kotlin in Action, 2E

How it is used
Uses receivers to add Kotlin-style operations to existing classes and to make builder-style lambdas readable.
How deep it goes
Explains receiver types, receiver objects, implicit this, lambda invocation, encapsulation limits, and Java compilation behavior.
Examples
Uses String.lastChar, buildString with StringBuilder, stored appendExcl, and a Java call to StringUtilKt.lastChar.
What you can do after
Apply Kotlin extension functions and receiver lambdas while translating their calls to Java static-method syntax.

Read how Kotlin in Action, 2E explains receiver →

100 Go Mistakes and How to Avoid Them

A receiver is the parameter of a Go method that identifies the value or pointer on which the method operates.

How it is used
Guides Go method design by distinguishing copied receivers from receivers that can mutate the original object.
How deep it goes
Explains copying, mutation, deferred evaluation, and selection conditions while deferring thorough value-versus-pointer performance treatment.
Examples
Uses customer balances, slice appending, nested pointer data, and deferred printing to expose receiver behavior.
What you can do after
Apply it by selecting value or pointer receivers based on mutation, copying constraints, receiver size, and deferred-call behavior.

Read how 100 Go Mistakes and How to Avoid Them explains receiver →

Also covered in

What to know first

Related concepts

Questions about receiver

What is receiver?

A receiver is an entity or value designated to accept a message, signal, or operation.

Which Manning books explain receiver?

The Well-Grounded Rubyist, Fourth Edition, Kotlin in Action, 2E and 100 Go Mistakes and How to Avoid Them.

What should I know before learning receiver?

Manning books that teach receiver usually introduce function first.

What kinds of receiver are there?

Kinds of receiver include default receiver and pointer receiver.

What is receiver part of?

Receiver is part of method. A method is a callable function or operation associated with a type, class, or object and invoked through that association.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.