--uXxzq0nDebZQVNAZ
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Ryan Davis:

> On Jun 16, 2011, at 04:29 , Piotr Szotkowski wrote:

>> I understand that for require to work relative to the given __FILE__
>> directory one needs to either $LOAD_PATH << File.dirname(__FILE__) or
>> use require_relative (with the latter being preferred, I presume).

>> Is there such an alternative for Kernel#autoload
>> and if not, should there be one?

>> I¡Çm thinking about lib/foo.rb containing

>> module Foo
>>  autoload :Bar, 'foo/bar'
>>  autoload :Baz, 'foo/baz'
>>  autoload :Qux, 'foo/qux'
>> end

>> (which doesn¡Çt work without $LOAD_PATH munging),

> I wouldn't call having 'lib' in your LOAD_PATH as munging.

Ok (and I understand your arguments).

> It just seems sane to me... Much more sane than
> File.dirname(__FILE__) does or require_relative.

Hm, I do prefer using require_relative over require + $LOAD_PATH
changes; it looks cleaner to me and doesn¡Çt touch shared
globals, but I guess that¡Çs more of a personal preference.

What I was trying to ask is whether there couldn¡Çt be
a Kernel#autoload_relative call or a ¡Ærelative: true¡Ç
optional parameter to Kernel#autoload to make it symmetric
with the require/require_relative combination. I understand
your answer would be ¡Æthere¡Çs no need¡Ç. :)

> (btw, you don't need the ".rb" part--that's just ugly)

Fully agreed; fixed in the quotation above
(I shouldn¡Çt post before my morning coffee).

¡½ Piotr Szotkowski
-- 
I consider chromatic to be Larry Wall¡Çs Thomas Huxley.
                   [Jarkko Hietaniemi, hates-software]




--uXxzq0nDebZQVNAZ
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk36NGUACgkQi/mCfdEo8Uo8vACgiQmYXJeA1LfnoAJshEOpwJgU
C0sAn1bJeLZSZOPLAmE9zFnb6kdgm3bp
w4
-----END PGP SIGNATURE-----

--uXxzq0nDebZQVNAZ--