liveBook · Manning

In position

An in position is a type-parameter usage position in which values of the parameterized type are accepted or consumed rather than produced.

How 2 Manning books explain it

Kotlin in Action, 2E

An in position is a type-parameter usage position in which values of the parameterized type are consumed rather than produced.

How it is used
Explains how generic type parameters are consumed by function parameters and how variance declarations constrain their use.
How deep it goes
Defines parameter and return positions, then connects them to covariance, contravariance, and nested type-argument checks.
Examples
Uses a consuming function parameter, covariant Herd, and read-only List to contrast in and out positions.
What you can do after
Apply it via Kotlin variance declarations by identifying whether each type-parameter use consumes or produces values.

Read how Kotlin in Action, 2E explains in position →

Fabulous Adventures in Data Structures and Algorithms

An input position is a type-parameter occurrence where values of the parameterized type are accepted or consumed rather than produced.

How it is used
Defines why contravariant interfaces permit assignments that reverse the direction of ordinary type relationships.
How deep it goes
Explains consumed type parameters, demonstrates assignment compatibility, and connects reversed mappings to category-theoretic arrows.
Examples
Uses animal comparers, Giraffe and Animal types, and the `IC<in T>` interface.
What you can do after
Apply contravariance by declaring an input-only interface parameter with the C# `in` modifier.

Read how Fabulous Adventures in Data Structures and Algorithms explains in position →

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.