Camping::Apps is back! I don''t know the *exact* reason it was being removed, but now it''s a monkey-patched array which at least doesn''t leak memory when using together with the reloader (were there more problems with this?). I really think we need this, since there''s no guaranty that only Camping-apps will have a class-method called #goes and "Object.constants.map{|c|Object.const_get(c)}" also caused a really weird error on Rubinus a while ago (I haven''t checked if this still applies). Anyway, I think it''s worth the bytes. I''ve pushed it to my experimental-branch[1] together with some other, semi-experimental (see [2]) and byte-saving patches. Can anyone who knows why it got pulled out, see if this version is "safe"? [1] http://bit.ly/judofyr-excamping [2] Getting rid of the old #meta_def and instead using modules: http://bit.ly/extend-not-define-on-metaclass
Hi Magnus, If I remember well, I am the one who introduced AND removed Camping::Apps. I''m not sure anymore but I think it wasn''t really used and that solutions never really satisfied me. Do you have any use for it ? Cheers, zimbatm
Well, it''s being used in mab.rb and ar.rb: Old way: Object.constants.map{|c|Object.const_get(c)}.each do |c| c::Models.module_eval $AR_EXTRAS if c.respond_to?(:goes) end New way: Camping::Apps.each do |c| c::Models.module_eval $AR_EXTRAS end Which may break if you got another class/module with #goes... On Thu, Aug 28, 2008 at 9:54 PM, zimbatm <zimbatm at oree.ch> wrote:> Hi Magnus, > > If I remember well, I am the one who introduced AND removed > Camping::Apps. I''m not sure anymore but I think it wasn''t really used > and that solutions never really satisfied me. Do you have any use for > it ? > > Cheers, > zimbatm > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Magnus Holm -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20080828/7c1fbc12/attachment-0001.html>
On Aug 28, 2008, at 1:54 PM, zimbatm wrote:> Hi Magnus, > > If I remember well, I am the one who introduced AND removed > Camping::Apps. I''m not sure anymore but I think it wasn''t really used > and that solutions never really satisfied me. Do you have any use for > it ?I most certainly do. In trying to keep the spirit of very simple apps working together, I''ve found getting a list of apps very useful. Also, good for The Camping Server to be able to make a list, too, I''d think. Aria Stewart aredridel at nbtsc.org
Now I remember, there is a quirk. Make sure to remove the old app in the array when reloading the app in the Camping::Reloader. Cheers, zimbatm
That''s why I have monkey-patched it: Apps = [].instance_eval do def <<(i) delete_if { |f| f.to_s == i.to_s} super end self end Ex1 = Class.new Apps << Ex1 # => [Ex1] Object.send(:remove_const, :Ex1) Ex1 = Class.new Apps << Ex1 # => [Ex1] # the old one has been deleted. Yes, I realize we could make some changes in camping/reloader.rb, but I think this is more intuitive and do got lot''s of spare bytes... On Fri, Aug 29, 2008 at 2:28 AM, zimbatm <zimbatm at oree.ch> wrote:> Now I remember, there is a quirk. Make sure to remove the old app in > the array when reloading the app in the Camping::Reloader. > > Cheers, > zimbatm > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Magnus Holm -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20080829/dc5394cb/attachment.html>