← Graph

Case Equality Interface

concept 2 connections

Ruby's `===` (triple-equals / case equality) method — the interface Joel Drapper identifies as Ruby's native type system. Classes match instances and subclass instances; Modules match includers/extenders; Ranges use `cover?`; Regexps match strings; Procs delegate to `call` (so any predicate proc becomes a type); default Object `===` matches same-object (making objects unit types by default); strings use value equality. Ruby's `case/when`, Enumerable#any?/#all?, and pattern matching all dispatch through this interface, which is why Literal can treat any `===`-responder as a type.

category
pattern
about
Case Equality Interface concept
Core claim: Ruby's === is Ruby's type interface.
tool Literal
uses
Case Equality Interface concept
Literal treats any object responding to === as a type.

Provenance

Read by
1 extraction