Hi --

On Sat, 3 Jan 2009, Robert Dober wrote:

> On Fri, Jan 2, 2009 at 5:30 PM, David A. Black <dblack / rubypal.com> wrote:
>
>> I'd be careful there. You're making a class-wide (all instances of
>> Class) change. (include is private, but still :-)
> What??? Are you actually suggesting I should test my code ;)?
>
> Seriously now. Your warning is of course noteworthy, but this is the
> price we have to pay for fixing 1.8 to 1.9 compatibility issues. So
> the concern of yours is actually what I was doing here, deciding to go
> for the 1.9 symbol version and allowing code to run with 1.8 too.

It doesn't allow it to run with 1.8, though, at least not safely. This
kind of thing is pretty common in 1.8:

    instance_methods.each {|m| undef(m) unless m =~ /^__/ }

which would blow up if they were symbols.

> But
> that was not really the issue of my post, maybe a new thread
> discussing compatibility techniques would be interesting too.
> Ok I see I have been as clear as ever :( sorry.
> My concern was, ok whenever I can do something which is *aware* of the
> existence of a method your technique is a very sound starting point of
> how to arrange things. But in the cases where I just add xxx and I am
> not aware of any actual xxx, what to do if there already is one?
> Probably the raise HelpMeException is pretty much the best we can do,
> but I was hoping for some ideas on this topic.

It's a tough problem. I don't think there's any general solution,
since you can't even use chaining since the two methods may have
nothing in common. I guess I tend to think that the case you're
describing is the case where things have gone irreparably wrong.


David

-- 
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)

http://www.wishsight.com => Independent, social wishlist management!