Trans wrote:
> I do put in effort to get Facets to not collide with ActiveSupport.
> But ... Take for instance #camelcase. In Rails that not only
> converts a snakecase string to camelcase, but will replace '::' with
> '/' for the sake of creating pathnames out of class names.
> Understandable for use by ActiveRecord, but is that what any one
> thinks of as camel-casing? Not really. A better name for Rails version
> would be #pathize IMHO. But I have no control over that.

All true, but a dialog with the Rails guys might yield some compromise.

>> there's a
>> case to be made for operating a registry/catalog of core class
>> extensions made by frameworks that wish to remain compatible?
> That's an interesting idea for sure. ... But it's a fairly big job and
> one has to ask if its really worth the effort.

I agree. However, it's not too hard to find where there might be
conflicts. For example, the following program yields a list of
methods (class and instance) added (but not those monkey-patched)
during a require. Facets and ActiveSupport have 45 extensions in
common. It wouldn't take too long to look through the implementations
looking for behavioural differences.

I have this program installed as "extensions":

#! /usr/bin/env ruby

# Return a hash for each defined class containing a array of two arrays,
# the first containing the class methods and the second the instance methods
def methods_by_class
  Module.
    constants.
    map{|klass| eval(klass)}.
    select{|klass| klass.is_a? Class}.
    inject({}){|h,klass|
        h[klass] = [
            klass.methods-klass.superclass.methods,
            klass.instance_methods-(klass.superclass ? klass.superclass.instance_methods : [])
          ]
        h
      }
end

before = methods_by_class

ARGV.each{|a| require a }

after = methods_by_class

# Print the difference between the before and after method lists:
before.keys.sort_by{|k| k.to_s}.each{|k|
    class_diff = after[k][0]-before[k][0]
    instance_diff = after[k][1]-before[k][1]
    next if class_diff.empty? && instance_diff.empty?
    puts((class_diff.sort.map{|c| "#{k}."+c} +
          instance_diff.sort.map{|c| "#{k}#"+c}
         )*"\n")
  }