Hey, I for one just had the feeling to put http://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/module/delegation.rb into the lib directory, and my first thought was, well ok, let's require it in Merb::BootLoader.before_app_loads.
Merb::BootLoader.before_app_loads do require Merb.root / "lib" / "delegation" end I really think this is simple enough! *Everyone* should have seen the init.rb file at least once and since the method has such a precise name, it's really not that hard to guess its purpose! Also, I have to say that I don't really like all kinds of automagic! Why not make it explicit that you want to load certain files before the app loads ,and some after that? It's good documentation at least! and really not that hard. If some automagic happens, I need to be aware about what kinds of that magic are happening! But what if I'm not interested in magic :)? Also, what if I want to turn off / change the magic? Say I temporarily *don't* want some file under lib required for testing whatever? I would need to know merb api to alter that behavior I guess!?! Without the magic, I would just state exactly what I want to do, like I would in any other ruby program. The only thing that is nice to know is that Merb.root exists (coming from rails myself I knew Rails.root, tried Merb.root and it worked :-) It really would'nt be hard without Merb.root either. I don't need to be aware about the way merb preloads things, I don't need to know that merb has a dependency method, I can simply rely on plain old ruby. Also, that way, I'm free to comment the require statement for whatever reason. I guess I made my opinion clear. Don't change anything, and rely on people's ability to look at init.rb and "guess" the meaning of the wonderfully named Merb::BootLoader.before_app_loads method. Maybe explicitly mention somewhere how to require files under lib, although it would look embarassingly simple :) cheers snusnu On Sun, Nov 16, 2008 at 11:06 PM, Julian Leviston <[EMAIL PROTECTED]> wrote: > > I reckon put the option in config. > > I reckon if they're using the "big daddy" version of merb, (ie the > full stack one, I can't remember what you call it), then autoloading > should be on, otherwise off. > > Possible? > > Julian. > > On 17/11/2008, at 5:34 AM, Michael Klishin wrote: > >> >> I wonder what end users think about autoloading from lib directory in >> the application. >> >> There are 2 opposite ideas on how it may work: >> >> 1. Lib is loaded before app. We have a patch for this but not sure if >> it should be merged. >> 2. lib is not loaded automatically, people can use >> before_/after_app_loads to do exactly what they want. >> >> Some seem to prefer #2 though AFAIR Rails, for instance, does >> autoloading from lib and thus some people may expect it. >> >> What do you think? >> -- >> MK >> >> > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
