← Graph

T.bind

concept 2 connections

Sorbet helper (`T.bind(self, SomeType)`) used inside included modules to tell Sorbet the runtime type of `self` when the module is mixed into a host class. Common workaround when `requires_ancestor` is not used. Erwin Kroon describes this pattern as 'annoying' and visible all over the codebase once you adopt Sorbet; he prefers redefining `self` via an RBI file instead.

category
practice
about
T.bind concept
Shows T.bind(self, ...) as a workaround for dependency-style modules.
concept T.bind
related_to
Sorbet tool
Sorbet runtime helper for rebinding self.

Provenance

Read by
1 extraction