Rewriting Rack: A Functional Approach
summary
Claim: rewrite Rack in Ruby using procs and lambdas and borrow immutable ideas from Clojure. Tools shown include replacing classes with closures, composing middleware as functions, and comparing Ruby code to Clojure equivalents. Surprising specifics: Rack::Builder is 171 lines (79 without comments), the library calls dup 29 times and freeze 96 times. A functional proc-based Rack stack is built and runs, it avoids shared mutable-state bugs (but does not magically solve every problem).
AI-written summary · about
chapters (13)
- 0:00Start
- 1:25John Mccarthy
- 4:29Python Exceptions
- 7:58Functional Programming
- 9:31Basic Closure
- 10:26Basic Function Definition
- 15:52Lambda
- 16:31Middleware
- 17:26How Middleware Is Implemented
- 18:37Simplify the Example
- 20:26Can We Do Functional Programming in Ruby
- 24:08Shared Mutable State
- 32:05Functions Instead of Objects
related talks
37mRuby on Rack: The Magic Between Request and Response
55mThe Future of Rack
41mRack - A Framework to Roll Your Own
28mRack for web developers
28mIn a World of Middleware, Who Needs Monolithic Applications
27mHarness the power of functions to build composable rack applications
30mThe Power of Middleware - Building Your Own Mini Web Framework on Rack
37mFunctional Programming in Ruby
