From: Yehuda Katz Date: 2011-11-23T08:58:32+09:00 Subject: [ruby-core:41230] Re: autoload will be dead --bcaec548a8f3848c2104b25b9452 Content-Type: text/plain; charset=ISO-8859-1 It is common to use autoload to register a number of incompatible options. For instance, Rack registers all possible server adapters, and loading the adapters has side-effects. I looked into this when I worked on Rails threadsafetiness and it is simply incorrect to preload anything registered as an autoload. Yehuda Katz (ph) 718.877.1325 On Tue, Nov 22, 2011 at 3:51 PM, Eric Wong wrote: > Yukihiro Matsumoto wrote: > > Today, I talked with NaHi about enhancing const_missing to enable > > autoload-like feature with nested modules. But autoload itself has > > fundamental flaw under multi-thread environment. I should have remove > > autoload when I added threads to the language (threads came a few > > months after autoload). > > Hi, many of my Ruby scripts/apps are single-threaded and I would > like to keep memory usage down. > > How about keeping autoload unchanged for single-threaded use and have > modules registered via autoload instantly require everything registered > when Thread.new is called? > > --bcaec548a8f3848c2104b25b9452 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable It is common to use autoload to register a number of incompatible options. = For instance, Rack registers all possible server adapters, and loading the = adapters has side-effects.

I looked into this when I wor= ked on Rails threadsafetiness and it is simply incorrect to preload anythin= g registered as an autoload.

Yehuda Katz
(ph) 718.877.1325


On Tue, Nov 22, 2011 at 3:51 PM, Eric Wo= ng <normalper= son@yhbt.net> wrote:
Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
> Today, I talked with NaHi about enhancing const_missing to enable
> autoload-like feature with nested modules. =A0But autoload itself has<= br> > fundamental flaw under multi-thread environment. =A0I should have remo= ve
> autoload when I added threads to the language (threads came a few
> months after autoload).

Hi, many of my Ruby scripts/apps are single-threaded and I would
like to keep memory usage down.

How about keeping autoload unchanged for single-threaded use and have
modules registered via autoload instantly require everything registered
when Thread.new is called?


--bcaec548a8f3848c2104b25b9452--