2009/6/16 Alexey P. [email protected]:
Not exactly understood what you mean, as i know ‘autoload’ works almost
the same as require - you should explicitly specify connection between
your classes and corresponding files.
So, instead of bunch of ‘require xxx’ there will be bunch of even longer
‘autoload xxx, xxx’ lines.
Not necessarily. Basically you need this only for the first constant
of a library. In the autoloaded file you can have more ‘autoload’
declarations. Or you require a single file which contains all the
initial autoload declarations and every subsequent file contains
further autoload declarations. If you provide this as a library then
usability for a user of that library is practically identical to your
approach - minus, you do not have to require another gem.
Class loader allows you to forget about it, just place your class file
wherever you want and it find it. It uses conventions to find your
classes and resources.
I know that approach from Java - and also all the issues that come
with automatic loading. You may end up loading other classes that you
There is no much sense to make one or two files to be loaded by
ClassLoader, the point is - make the whole project loaded by it (and
forget about require) or don’t use it at all.
If I were to distribute a gem I would try to limit dependencies to
other gems. If I can achieve the same effect for my users with built
in features I would stick to them. I may be missing something here
but that’s the reason why I suggested you provide a short summary of
using your gem vs. built in features. If you want your gem to be used
you should probably do /some/ advertising.