Ruby (4.0)
This assessment applies the coupling account — coupling as access to a shared resource, and the coupling floor [1], [2] — and the knowledge-embodiment theorem [3]; the language is assessed against its official reference [4].
Analysis against Ruby 4.0 (December 2025). YJIT is production-ready since Ruby 3.2+.
Snapshot Ruby (4.0) — released 25 December 2025 · lifecycle current
Family Ruby — shelf: Application
The language’s main business is building general application software, with a managed runtime or a rich standard library. A shelf groups; it does not classify — the tags below carry every use, paradigm, and platform of this snapshot.
Trajectory 0.95 (21 December 1995 — first public release) · 4.0 (25 December 2025 — assessed release)
Tags
Use — Application, Web back end, Scripting
Paradigm — Object-oriented, Imperative
Lifecycle — Current
Memory — Managed (GC)
Typing — Dynamic
Resources
The language’s official entry points, and the documents that name the release this page assesses. A link marked this release pins the document to Ruby (4.0); an unmarked link is the current reference for the language.
Landing page
Specification and reference
API documentation
- Ruby core and standard library API
- Ruby 4.0 documentation this release
Tutorial
Package registry
1 Assessment
This page assesses Ruby in five parts: core coupling — what the language’s own constructs force; ecosystem coupling — what the surrounding platform, tooling, and community cost; engineering readiness — whether the artifact can be reproduced, verified, observed, worked in quickly, connected to other languages, and governed openly; the profile — the unscored facts a score cannot express; and the scoring detail — the mechanism marks and the arithmetic behind every score. A ✅ bullet marks a construct that helps. A ⚠️ or ❌ bullet marks a cost; the scoring model does not price every cost named here.
Core coupling 56.3/100 · Ecosystem coupling 82.8/100 · Engineering readiness 84.2/100
1.1 Core coupling
1.1.1 Type
- ❌ Duck typing: No compile-time type checking, coupling invisible
- ❌ Pattern matching (3.0+) is not exhaustive: A
case/inwith noelseraisesNoMatchingPatternErrorat run time rather than reporting a missing case - ✅ Mixins: Include modules for behavior without inheritance
- ⚠️ Open classes: Can modify any class, creates action-at-a-distance coupling
- ⚠️ RBS type signatures: External type system (
.rbsfiles) — static checking via Steep/Sorbet, not built into runtime - ✅ Blocks/Procs/Lambdas: First-class functions decouple behavior
- ❌ Method_missing: Dynamic dispatch hides coupling, runtime failures
1.1.2 Construction
- ✅
initializeseparate fromnew: Construction logic decoupled - ✅ Data.define (3.2+): Immutable value objects like records/kotlin data classes
- ⚠️ Class methods for factories: Common pattern but not enforced
- ❌ Monkey patching: Can modify any class anywhere, global coupling
- ❌ Global variables:
$globalcreates pervasive coupling - ❌ Class variables:
@@varshared across all instances, couples classes - ❌ One value, many names: every value is an object reached by reference, and the in-place mutators (<<, map!) change the object every name shares (C6)
- ❌ require executes files at load; a cyclic require re-enters a half-loaded file (the warning is documented) (C8)
1.1.3 Memory
- ✅ Garbage collection: Automatic, no manual management
- ⚠️ GC pauses: Non-deterministic, couples performance to runtime (improved by YJIT’s reduced allocation rate)
- ✅ No manual deallocation: Can’t have use-after-free
- ✅ YJIT reduces GC pressure: Faster execution means fewer long-lived allocations
1.1.4 Error
- ❌ Unchecked exceptions:
raisedoesn’t appear in signatures - ❌ Broad rescue:
rescuewithout type catches everything - ✅ Pattern matching with
=>operator (3.0+): Can destructure error objects structurally - ❌ Silent failures: Methods often return nil instead of raising
1.1.5 Concurrency
- ❌ Global VM Lock (GVL): Like Python’s GIL, couples threads to single core (K1)
- ✅ Fibers + Fiber Scheduler (3.0+): Cooperative concurrency with io_uring support for async I/O
- ✅ M:N thread scheduler (3.3+, experimental → progressing): Lightweight userspace threads
- ⚠️ Ractors: Actor-like concurrency (3.0+), still evolving
- ❌ Shared mutable state: No protection, every field reachable from every thread (K2)
- ❌ Manual synchronisation, no race detection: Locks are library calls, and the language reports no data race (K3)
1.1.6 Platform
- ✅ No company owns the language: Ruby is developed by the ruby-core community under the Ruby Licence, dual-licensed with the two-clause BSD licence
- ✅ Several implementations exist: MRI (Matz’s Ruby Interpreter) is the reference implementation, alongside JRuby on the JVM, TruffleRuby on GraalVM, and mruby for embedded use
- ✅ The runtime is portable: MRI builds on Linux, macOS, Windows through RubyInstaller, and the BSDs
- ✅ The JVM is an available target: JRuby runs the same language on the Java platform, so Ruby code is not confined to one runtime
- ✅ Packaging is vendor-neutral: RubyGems and Bundler fetch gems from any repository, not from one vendor’s service
1.1.7 Trade-offs (not coupling)
- Parentheses are optional: The grammar treats a method call and a local variable alike, a readability choice whose cost is ambiguity in dense expressions
- Everything is an object: Numbers, strings, and classes all respond to methods, a uniform model that removes special-case rules and adds method lookup to every value
- Visibility is cooperative:
privatemarks the intent, andsendcan still reach past it — a deliberate openness in the object protocol rather than a dependency between components
1.2 Ecosystem coupling
1.2.1 Performance
- ✅ YJIT (production-ready since 3.2): 3–5x speedup in many benchmarks; reduced GC pressure
- ❌ GVL: Couples multithreading to single core (still present in Ruby 4.0)
- ⚠️ The JIT is opt-in: YJIT must be enabled with
--yjitorRUBY_YJIT_ENABLE=1, so a default run stays interpreted - ⚠️ High memory: Object overhead significant (partially offset by YJIT)
- ⚠️ Optimization hard: Dynamic nature limits static optimization
1.2.2 Ecosystem
- ✅ RubyGems: Massive ecosystem
- ⚠️ Rails dominates the ecosystem: Most Ruby applications are Rails applications, so the framework’s conventions and release cycle set the pace for the rest
- ✅ Bundler: Dependency management works well
- ✅ IDE support: RubyMine, VSCode good
- ✅ Rich ecosystem: Mature, well-established
- ✅ The extension ABI is promised inside a minor line: Ruby’s version policy keeps ABI compatibility within one MINOR level [5] (Ec8)
- ✅ Stored data crosses on a published promise: the Marshal stream carries major and minor version numbers, and Ruby loads data written with the same major version and an equal or lower minor version [6] (Ec9)
1.2.3 Evolution
- ✅ Backward compatible: Ruby 2→3→4 mostly smooth
- ✅ Regular releases: Annual release cycle
- ✅ YJIT: Major performance investment
- ⚠️ RBS/Sorbet: Type signatures external, not core language
- ⚠️ GVL: Still present, no removal timeline
1.2.4 Domain
- ✅ Excellent for web: Rails is industry standard
- ✅ Good for scripting: Clean syntax for automation
- ⚠️ Improved for performance-sensitive: YJIT closes gap but still slower than compiled languages
- ❌ Not for systems: GC, interpreted, GVL
- ⚠️ DevOps tools: Chef, Puppet use Ruby
1.2.5 Learning
- ✅ Very gentle: Readable, intuitive
- ✅ Principle of least surprise: Design philosophy
- ✅ Excellent resources: Why’s Poignant Guide, Rails tutorials
- ✅ Quick productivity: Can build apps immediately
1.2.6 Syntax
- ✅ Beautiful syntax: Minimal noise, readable
- ✅ Flexible: Multiple ways to express intent
- ✅ Blocks: Elegant for DSLs and callbacks
- ✅ Optional parentheses: Clean, natural language-like
1.2.7 Testing
- ✅ RSpec, Minitest: Excellent testing frameworks
- ✅ Pry: Interactive debugger, REPL
- ✅ Test culture: TDD/BDD strong in Ruby community
- ⚠️ Runtime errors: No compile-time checks
1.2.8 Security
- ✅ Memory safe: GC prevents memory bugs
- ❌ Type confusion: Dynamic typing allows anything
- ❌ Monkey patching: Can introduce vulnerabilities
- ⚠️ Rails security: Framework helps, but language-level gaps
1.2.9 Delivery targets
What ships from a producer to a consumer, and whether the interface across a release boundary is promised. Ec8 is present when one compiled target crosses with no promise.
| Target | Ships as | Crosses a producer boundary | Cross-release promise |
|---|---|---|---|
| source gem | source | no | A gem ships Ruby source |
| native gem | compiled | yes | yes — Ruby’s version policy keeps ABI compatibility within one MINOR level, so a gem built in the line loads on later releases of it [5] |
1.2.10 Stored data formats
What the toolchain stores that outlives the program, and what the vendor publishes about reading it across a release boundary. Ec9 is present when one row carries a break: the reading promise published as broken, the writing direction published as unreadable elsewhere, or a break the probe harness has reproduced.
| Stored format | Reading promise | Writing promise |
|---|---|---|
| Marshal stream — stored objects | yes — Ruby publishes the promise for marshaled data: the stream carries major and minor version numbers, and marshaling loads data written with the same major version number and an equal or lower minor version number [6] | — |
1.3 Engineering readiness
1.3.1 Reproducibility
- ❌ No lockfile exists unless Bundler is adopted; resolution follows the gem index. (Y1)
- ❌ The official distribution ships no toolchain pin; rbenv and asdf are third-party. (Y14)
1.3.2 Supply chain
- ❌ The gem name space is flat: one global namespace decides ownership. (Y4)
- ⚠️ Advisory coverage is external: RubyGems publishes no first-party advisory feed, and OSV and the GitHub Advisory Database cover the gap
1.3.3 Observability
- ✅ An uncaught exception prints a backtrace with line numbers by default. (Y15)
1.3.4 Feedback
- ✅ The interpreter runs with no build step. (Y7)
- ✅ The debug gem ships as a default gem of the interpreter. (Y13)
1.3.5 Interop
- ✅ Fiddle, a default gem, wraps libffi for in-process foreign calls. (Y9)
- ✅ The interpreter ships builds for the common platforms. (Y10)
1.3.6 Governance
- ✅ The committers govern in the open; no vendor owns the language. (Y11)
- ✅ ISO/IEC 30170 publishes the language specification. (Y12)
- ✅ The interpreter source is public. (Y19)
1.4 Profile
Unscored, and kept separate from every score on purpose. The profile records what a mechanism price cannot express: what a running program costs, how well a coding model and an agent work in the language, and whether a safety-critical path exists.
1.4.1 Energy and cost
What this axis asks: what does a running program cost in energy and time?
1.4.2 AI and agent readiness
What this axis asks: how well does a coding model and an agent work in this language?
1.4.3 Safety certification
What this axis asks: is there a certified or standards-qualified path to a safety-critical system?
- ❌ No certified or standards-qualified path for safety-critical systems.
1.5 Scoring detail
1.5.1 Core coupling Dimensions
| Dimension | Mechanism | Description | Imposed by | Present | Weight |
|---|---|---|---|---|---|
| Type | T1 |
dynamic no static check | language | ✅ | −15 |
T2 |
weak static | language | — | 0 | |
T3 |
dynamic/duck dispatch | language | ✅ | −8 | |
T4 |
no sum types | language | ✅ | −4 | |
T5 |
no generics | language | ✅ | −4 | |
T6 |
no namespaces | language | — | 0 | |
T7 |
type erasure/reflection | language | — | 0 | |
T8 |
operator overloading | language | — | 0 | |
T9 |
inheritance required for polymorphism | language | — | 0 | |
T10 |
no null-safety | language | ✅ | −8 | |
T11 |
no module boundary | language | — | 0 | |
T12 |
no effect tracking | language | ✅ | −8 | |
T13 |
async/sync colouring | language | — | 0 | |
T14 |
unchecked foreign boundary | language | ✅ | −4 | |
T15 |
chars are encoding units | language | — | 0 | |
| Type cost | −14.6 (−51) | ||||
| Construction | C1 |
global mutable state by default | language | ✅ | −15 |
C2 |
no immutability by default | language | ✅ | −4 | |
C3 |
constructors coupled to allocation | language | — | 0 | |
C4 |
no constructor/validation | language | — | 0 | |
C5 |
unpinned collection order | language | — | 0 | |
C6 |
aliasing by default | language | ✅ | −8 | |
C7 |
undeclared control transfer | language | — | 0 | |
C8 |
no source-visible init order | language | ✅ | −8 | |
| Construction cost | −10.0 (−35) | ||||
| Memory | M1 |
manual deallocation | runtime | — | 0 |
M2 |
GC non-deterministic pauses | runtime | ✅ | −8 | |
M3 |
no RAII | language | ✅ | −4 | |
M4 |
no ownership model | language | ✅ | −8 | |
M5 |
uninitialized reads | language | — | 0 | |
M6 |
unchecked reinterpretation | language | — | 0 | |
Er6 |
uncatchable runtime fault | language | — | 0 | |
M7 |
reference cycles leak | runtime | — | 0 | |
| Memory cost | −5.7 (−20) | ||||
| Error | Er1 |
no structured path | language | — | 0 |
Er2 |
unchecked exceptions only | language | ✅ | −8 | |
Er3 |
errors ignored/non-exhaustive | language | ✅ | −4 | |
Er4 |
no composable result type | language | — | 0 | |
Er5 |
no isolation unit for a fault | runtime | — | 0 | |
| Error cost | −3.4 (−12) | ||||
| Concurrency | K1 |
GIL/no parallel | runtime | ✅ | −15 |
K2 |
shared mutable state default | language | ✅ | −8 | |
K3 |
manual sync no race detection | runtime | ✅ | −8 | |
K4 |
no structured concurrency | language | ✅ | −4 | |
K5 |
no primitives | language | — | 0 | |
K6 |
thread-per-task cost | runtime | — | 0 | |
| Concurrency cost | −10.0 (−35) | ||||
| Platform | P1 |
cannot function outside one vendor/domain | context | — | 0 |
P2 |
single-vendor but other uses | context | — | 0 | |
P3 |
legacy/discontinued platform | context | — | 0 | |
P4 |
poor domain fit | context | — | 0 | |
| Platform cost | 0 |
Core coupling score: 56.3/100 — 153 of the 350 inventory points are present, so the axis cost is 100 × 153 ÷ 350 = 43.7 and the score is 100 − 43.7. Each dimension’s cost above is its share of the same denominator, and the raw weight sum follows in parentheses.
1.5.2 Ecosystem coupling Dimensions
| Dimension | Mechanism | Description | Imposed by | Present | Weight |
|---|---|---|---|---|---|
| Performance | R1 |
interpreted no AOT/JIT | runtime | ✅ | −8 |
R2 |
GC pauses | runtime | — | 0 | |
R3 |
JIT warmup | runtime | — | 0 | |
| Performance cost | −3.1 (−8) | ||||
| Ecosystem | Ec1 |
no package manager | context | — | 0 |
Ec2 |
fragmented tooling | context | — | 0 | |
Ec3 |
small/niche/discontinued | context | — | 0 | |
Ec4 |
proprietary | context | — | 0 | |
Ec5 |
platform-locked tooling | context | — | 0 | |
Ec6 |
monoculture | context | ✅ | −8 | |
Ec7 |
legacy burden | context | ✅ | −8 | |
Ec8 |
unpromised binary boundary | context | — | 0 | |
Ec9 |
unpromised data boundary | context | — | 0 | |
| Ecosystem cost | −6.2 (−16) | ||||
| Evolution | V1 |
breaking changes | language | — | 0 |
V2 |
frozen | context | — | 0 | |
V3 |
discontinued | context | — | 0 | |
V4 |
glacial standards | context | — | 0 | |
V5 |
silent default drift | runtime | — | 0 | |
V7 |
build-variant state space | context | — | 0 | |
| Evolution cost | 0 | ||||
| Domain | D1 |
domain/vendor lock-in | context | — | 0 |
D3 |
framework forces architecture | context | — | 0 | |
| Domain cost | 0 | ||||
| Learning | L1 |
steep | context | — | 0 |
L2 |
large surface/multi-paradigm | context | — | 0 | |
L3 |
sparse docs | context | — | 0 | |
| Learning cost | 0 | ||||
| Syntax | S1 |
verbose | language | — | 0 |
S2 |
inconsistent | language | — | 0 | |
S3 |
punctuation-heavy | language | — | 0 | |
| Syntax cost | 0 | ||||
| Testing | G1 |
weak tooling | context | — | 0 |
G2 |
poor debugging | context | — | 0 | |
G3 |
runtime-only errors | context | ✅ | −4 | |
G4 |
no published monotonic clock | runtime | — | 0 | |
| Testing cost | −1.6 (−4) | ||||
| Security | Q1 |
memory-unsafe | language | — | 0 |
Q2 |
dynamic/weak typing risk | language | ✅ | −8 | |
Q3 |
known vulnerability/injection | context | ✅ | −8 | |
Q4 |
silent integer overflow | language | — | 0 | |
| Security cost | −6.2 (−16) |
Ecosystem coupling score: 82.8/100 — 44 of the 256 inventory points are present, so the axis cost is 100 × 44 ÷ 256 = 17.2 and the score is 100 − 17.2. Each dimension’s cost above is its share of the same denominator, and the raw weight sum follows in parentheses.
1.5.3 Engineering readiness Dimensions
| Dimension | Mechanism | Description | Imposed by | Present | Weight |
|---|---|---|---|---|---|
| Reproducibility | Y1 |
build not reproducible | context | ✅ | −15 |
Y2 |
dependencies not pinned | context | — | 0 | |
Y14 |
no toolchain version pin | context | ✅ | −8 | |
Y18 |
no machine-read project contract | context | — | 0 | |
| Reproducibility cost | −13.5 (−23) | ||||
| Supply chain | Y3 |
no signed provenance | context | — | 0 |
Y4 |
registry without namespacing | context | ✅ | −4 | |
Y16 |
no advisory feed | context | — | 0 | |
| Supply chain cost | −2.3 (−4) | ||||
| Observability | Y5 |
no stable tracing standard | context | — | 0 |
Y6 |
no structured logging | context | — | 0 | |
Y15 |
no post-mortem diagnostics | runtime | — | 0 | |
| Observability cost | 0 | ||||
| Feedback | Y7 |
slow build | context | — | 0 |
Y8 |
no fast in-editor analysis | context | — | 0 | |
Y13 |
no bundled debugger | context | — | 0 | |
| Feedback cost | 0 | ||||
| Interop | Y9 |
no foreign-function interface | language | — | 0 |
Y10 |
no portable target | context | — | 0 | |
| Interop cost | 0 | ||||
| Governance | Y11 |
single-vendor governance | context | — | 0 |
Y12 |
closed specification | context | — | 0 | |
Y17 |
no conformance mechanism | context | — | 0 | |
Y19 |
no published parser | context | — | 0 | |
| Governance cost | 0 |
Engineering readiness score: 84.2/100 — 27 of the 171 inventory points are present, so the axis cost is 100 × 27 ÷ 171 = 15.8 and the score is 100 − 15.8. Each dimension’s cost above is its share of the same denominator, and the raw weight sum follows in parentheses.
Verdict: Ruby prioritizes developer happiness over low coupling by language design. Pattern matching (3.0+) and Data.define (3.2+) add structured data handling. YJIT transforms performance. Main strength: readable, expressive syntax makes intent clear. Main weakness: all coupling detection deferred to runtime, metaprogramming creates invisible dependencies, GVL persists.
The formal development. The definitions, theorems, and proofs behind this page are published in:
- On the Nature of Coupling: All Coupling as Shared Resource Access — Zenodo, 2026 — doi:10.5281/zenodo.21925122
- Coupling as a Consequence of Cohesion: Decomposition, the Coupling Floor, and Domain-Imposed Coupling — Zenodo, 2026 — doi:10.5281/zenodo.21925201
- On the Nature of Cohesion: Cohesion as Correctness Relative to a Partitioning Rule — Zenodo, 2026 — doi:10.5281/zenodo.21703193