May be I am missing something (since I am not MRI hacker), but why there is no module exclusion functionality — i.e. you can extend object with module, but can’t reverse this operation? Any specific reason for this decision, do you know?
I’ve just sketched simplistic implementation for this kind of functionality and really wondering why there is no such stuff in MRI.
Again, am I missing something?





Interesting code. I’m not a ruby hacker as well. Have you tried submitting this to the ruby-core list?
I can’t subscribe to ruby-core list for some reason.
I really like the premise, but I believe the implementation using RubyGems and Inline is killing it for me. Why couldn’t this just be a Ruby C Module? Like some of the speedier parts of the core library?
Ill have to play with this when Im actually at my desk. Thanks!
Justin,
of course it might make sense to implement it as a Ruby C module. The point of this post and initial implementation is rather to show the idea.
Another point for rubygem and inline is that I use this code snippet in strokedb and since it anyway makes use of RubyInline, it is absolutely fine to use it here as well.
BTW, http://groups.google.com/group/ruby-core-google/browse_frm/thread/bca81cb2c2fedab8
You might want to check out mixology – http://rubyforge.org/projects/mixology/
It enables modules to be mixed in and then unmixed. One good use case for it is using modules to implement the state pattern. More on that here: http://www.somethingnimble.com/bliki/mixology