[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    Re: Any reason for having no module exclusion functionality in Ruby
From:       Kurt Stephens <ks () kurtstephens ! com>
Date:       2008-04-24 5:22:34
Message-ID: 4810190D.8000806 () kurtstephens ! com
[Download RAW message or body]

Yehuda Katz wrote:
> +1.
> 
> Being able to unextend modules would make it possible to temporarily
> give methods to an object that were easily removable. I've had a number
> of use-cases for it in the past few months.
> 
> -- Yehuda

+1

We do something similar when testing legacy code that is difficult to
decouple.  We have an DSL object that can redefine methods before a
block, yields to a block and then restores the methods after the block
completes.

It would be so much cleaner if we could just extended and unextend.  It
would also be nice to do the same with include: uninclude?

-- Kurt Stephens

> 
> On Apr 23, 2008, at 3:50 PM, Pit Capitain wrote:
> 
>> Hi all, I'm forwarding the following message for Yurii, who seems to
>> have problems joining ruby-core. The current implementation can be
>> found here:
>>
>> http://github.com/yrashk/rbmodexcl/tree/master
>>
>> Regards,
>> Pit
>>
>> ---------- Forwarded message ----------
>> From: Yurii Rashkovskii <yrashk@gmail.com>
>> Date: 2008/4/22
>> Subject: Any reason for having no module exclusion functionality in R
>> To: ruby-talk ML <ruby-talk@ruby-lang.org>
>>
>>
>> Hello,
>>
>> 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?
>>
>> I've just sketched simplistic implementation for this kind of
>> functionality (http://pastie.org/185000) and really wondering why
>> there is no such stuff in MRI.
>>
>> Again, am I missing something?
>>
>> Yurii.
>> -- 
>> Posted via http://www.ruby-forum.com/.
>>
> 
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic