From: Yehuda Katz Date: 2011-11-19T17:17:29+09:00 Subject: [ruby-core:41153] Re: autoload will be dead --20cf307abf2f84f9bc04b21215a5 Content-Type: text/plain; charset=ISO-8859-1 Yehuda Katz (ph) 718.877.1325 On Sat, Nov 19, 2011 at 12:06 AM, Hiroshi Nakamura wrote: > Hi, > > On Sat, Nov 19, 2011 at 16:21, Yehuda Katz wrote: > > Does this also mean that we will not enhance const_missing to support > nested > > modules? > > No, it doesn't. I explained your request at #2740 first, and we > discussed the way to solve it (no conclusion yet.) I'll update #2740 > later. > > > I think it is still possible to make require itself threadsafe, if we > use a > > single lock for requires, as Charlie Nutter has previously proposed. > > I don't know that single lock solution is acceptable, because the > cross-require issue is caused by developer's error we think, and > should be easily avoidable (Just don't do!) It would be too big > restriction to save this error. > The few cases I have personally discovered in Rails were complex cases that weren't obvious at first glance. When a lot of code is involved in the autoload process, it's very easy for some cross-require cases to exist (usually through intermediate code). In my mind, making threadsafety guarantees about require, even if they come with some caveats, is far better than simply warning developers not to do "the wrong thing" in their apps or libraries in the case where code is being loaded lazily in the presence of threads. > > In contrast to it, autoload can cause unintentional cross-require. So > I talked to Matz about #2740. > > > Honestly, if we improve const_missing and make `require` capable of being > > threadsafe, it will be easy to implement autoload in terms of those > > primitives. > > I explained exactly along the same line, not sure Matz agreed or not > though. Let's keep discussing in #2740. > > --20cf307abf2f84f9bc04b21215a5 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Yehuda Katz
(ph) 718.877.1325


On Sat, Nov 19, 2011 at 12:06 AM, Hirosh= i Nakamura <naka= hiro@gmail.com> wrote:
Hi,

On Sat, Nov 19, 2011 at 16:21, Yehuda Katz <wycats@gmail.com> wrote:
> Does this also mean that we will not enhance const_missing to support = nested
> modules?

No, it doesn't. =A0I explained your request at #2740 first, and w= e
discussed the way to solve it (no conclusion yet.) =A0I'll update #2740=
later.

> I think it is still possible to make require itself threadsafe, if we = use a
> single lock for requires, as Charlie Nutter has previously proposed.
I don't know that single lock solution is acceptable, because the=
cross-require issue is caused by developer's error we think, and
should be easily avoidable (Just don't do!) =A0It would be too big
restriction to save this error.

The few= cases I have personally discovered in Rails were complex cases that weren&= #39;t obvious at first glance. When a lot of code is involved in the autolo= ad process, it's very easy for some cross-require cases to exist (usual= ly through intermediate code).

In my mind, making threadsafety guarantees about requir= e, even if they come with some caveats, is far better than simply warning d= evelopers not to do "the wrong thing" in their apps or libraries = in the case where code is being loaded lazily in the presence of threads.
=A0

In contrast to it, autoload can cause unintentional cross-require. =A0So I talked to Matz about #2740.

> Honestly, if we improve const_missing and make `require` capable of be= ing
> threadsafe, it will be easy to implement autoload in terms of those > primitives.

I explained exactly along the same line, not sure Matz agreed or not<= br> though. =A0Let's keep discussing in #2740.


--20cf307abf2f84f9bc04b21215a5--