liveBook · Manning

Receiver

A receiver is an entity that accepts a message or signal, or an object on which a method or command operates.

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 →

Related concepts

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.