With Chris' proposal a few days ago, we now have a way to easily lazy-load specific types of processing. I think it's worthwhile to consider what sorts of things belong in middleware and what sorts of things should be added to Rack::Request.
It seems to me that anything that could potentially be lazy-loaded should go on Rack::Request, because middleware would either require mandatory loading or a DeferredHash kind of hack. An obvious thing that comes to mind is params parsing. It would be easy enough to use the DeferredHash hack to make it a middleware, but just having Rack::Request#params means that you can keep that sort of logic in the object (where it can be more easily managed).
Another potential benefit of keeping it on the object could be perf (having very large numbers of middlewares, each doing very simple things, could get non-performant pretty quickly).
What do people think?
--
Yehuda Katz
Developer | Engine Yard
(ph)
718.877.1325