15

Having read a couple weeks ago that autoload is officially deprecated, Matz discourages use of it. What is to replace it? What should developers do instead? I used it in some command-line gems to save unnecessary loading of libs that may never be used, as well as in JRuby to prevent the same for .jar files.

Nick Klauer
  • 5,893
  • 5
  • 42
  • 68

1 Answers1

3

I've seen people use the EasyLoad gem, it claims to be a autoload alternative. It loads based on directory module naming convention.

Donavan White
  • 1,126
  • 10
  • 23
  • 2
    As the author of easyload; I haven't touched it in a very long time. If there's renewed interest, I'd love to hand it off to a more active maintainer – Nevir Apr 04 '12 at 00:55
  • I have great interest in EasyLoad, I'm currently writing a library for interacting with various shipping carriers and I have been debating using EasyLoad for that, I would be more than happy to maintain it. Thanks. – Donavan White Apr 04 '12 at 23:06
  • Ping me on github; let's figure out the best way to transition the repo & gem – Nevir Apr 05 '12 at 21:19
  • 2
    If Easyload was the replacement for ruby's autoload, why is its first instruction a call to autoload? – Pablo Marambio Oct 29 '13 at 03:08
  • 1
    @PabloMarambio - Good point. It looks like that's the only use of autoload, and it's just loading a version file. I think it will be trivial for the gem's maintainer to change, when autoload finally goes away (although it really out to be done sooner). – Wayne Conrad Mar 02 '14 at 16:48
  • 1
    @WayneConrad - When I get a second, I'll look at it and make the modifications to remove the autoload call. – Donavan White Mar 03 '14 at 17:39