← Graph

Ruby has literally always had types

talk 22 connections

Joel Drapper's wroclove.rb 2025 talk (first speaker of the day). Opens with a Shopify war story where interpolating a nil email into a Zendesk query caused 4,000–10,000 tickets to be deleted (a bug involving Puma, Rails, and a race condition that became a CVE in both) — framed as what runtime types would have prevented. Surveys existing static-typing efforts (Sorbet, RBS, Steep by Soutaro Matsumoto) and argues they don't fit Ruby's meta-programmed dynamism, require writing ~2× more code, and introduce more surface area for bugs. Defines a type as 'a description of a set of objects' and claims any Ruby object responding to `===` (triple-equals / case equality) is a type — classes, modules, ranges, regexes, procs, and even plain objects (as unit types). Notes that case/when, Enumerable#any?/all?, and pattern matching already use this interface. Introduces Literal, which exposes generics (Array, Tuple, Hash, Union, Intersection, Constraint, Interface, Deferred for recursive JSON), LiteralStruct/LiteralData (Ruby Struct/Data replacements taking typed `prop` declarations), Literal::Properties (to mix this into any class, e.g. a Phlex HTML Button component with union types for size/variant), Literal::Enum (constant enumerations with value/predicate/coerce methods), and Literal::Value/Decorator (wrapping a single value like UserID, delegating selected methods). Covers implementation details: nilable types are intentionally ugly; reserved keywords like `class` handled via binding.local_variable_get; code generation means near-zero runtime allocation overhead; primitive unions compile to set lookups (O(1)); types flatten; boot-time allocation is copy-on-write shared. Roadmap: literal array/tuple/hash/set collection objects that can't be corrupted post-initialization; subtype comparison between types (apple < fruit) to short-circuit collection operations (variance); cross-property validation via named block parameters; a result monad integrated with the type system; and LLM-schema generation/validation. Frames the approach as a Goldilocks solution — not full static safety, but composable runtime types, great error messages, compatible with metaprogramming, usable in 5 minutes, with Stephen's 'accordion of complexity' progression (Array → Array of User → can't push wrong → min 2 → name the concept 'group members'). Summary claim: Ruby has runtime types and always has — we just thought too narrowly. Q&A covers Literal vs dry-types (Literal uses `===`, dry puts coercion/default on the type — wrong place), production behavior (raises, but they saw fewer prod errors at Clear Scope), pattern-matching signatures at method boundaries, using Literal as a validation-library base (needs a non-raising `validate` path), writing types in separate files like RBS (not explored — fewer lines already), and observing production to auto-generate types (not a great idea — unions can't be inferred from observations, anomalies would create false types).

date
2025-03-14
type
talk
duration
45 minutes
talk Ruby has literally always had types
about
Literal tool
The talk introduces and demonstrates Literal's types, struct/data, properties, enums, values, and decorators.
talk Ruby has literally always had types
about
Core claim: Ruby's === is Ruby's type interface.
talk Ruby has literally always had types
about
Drapper's working definition of what a type is.
talk Ruby has literally always had types
about
Central argument of the talk.
talk Ruby has literally always had types
about
Types at object boundaries make invalid states unrepresentable.
talk Ruby has literally always had types
about
Drapper uses Stephen Margheim's accordion-of-complexity framing to describe Literal's incremental safety layers.
talk Ruby has literally always had types
about
Sorbet tool
Discussed as the furthest-along static type checker for Ruby; contrasted with Literal's runtime approach.
talk Ruby has literally always had types
about
RBS tool
Covered as the official Ruby type-signature language (no checker of its own).
talk Ruby has literally always had types
about
Steep tool
Cited as the best available type checker for RBS.
talk Ruby has literally always had types
about
dry-types tool
Contrasted with Literal in Q&A: dry-types bundle coercion/defaults in the type.
talk Ruby has literally always had types
about
Phlex tool
Phlex Button component demonstrated as a user of Literal::Properties.
asked_at
Ruby has literally always had types talk
First audience Q&A question.
asked_at
Ruby has literally always had types talk
Second audience Q&A question.
asked_at
Ruby has literally always had types talk
Third audience Q&A question about method-level typing.
asked_at
Ruby has literally always had types talk
Follow-up Q&A question.
asked_at
Ruby has literally always had types talk
Q&A question on verbosity and external type files.
asked_at
Ruby has literally always had types talk
Final Q&A question on Coverband-style production observation generating types.
person Joel Drapper
authored
Ruby has literally always had types talk
Joel Drapper delivered this talk at wroclove.rb 2025.
from_talk
Ruby has literally always had types talk
Core takeaway summarizing the talk's thesis.
from_talk
Ruby has literally always had types talk
Lesson drawn from the Shopify/Zendesk incident and Clear Scope's deployment.
from_talk
Ruby has literally always had types talk
Drapper urges extracting Latitude, UserID, GroupMembers as named types.
talk Ruby has literally always had types
presented_at
First speaker of wroclove.rb 2025, delivered on 2025-03-14.

Provenance

Created
2026-04-17 16:17 seed
Read by
13 extractions