On Wed, 27 Jul 2005, Charles Steinman wrote:

> redentis wrote:
>> From what you're saying, the answer in Ruby is to examine the code
>> and/or the documentation, which is reasonable enough, but, it does seem
>> to make it much more difficult to extend frameworks written in Ruby.
>> Particularly since you wouldn't know whether you'd missed a method
>> until you attempted to run some code.
>
> This sounds like a good use for unit tests, if you ask me.

absolutely.  plus, it's easy enough to check:

   harp:~ > cat a.rb
   module Interface
     MUST = %w(
       foo
       bar
       foobar
     )
     class << self
       def included other
         MUST.each{|m| raise "must have ##{ m }" unless other.instance_methods.include? m}
         super
       end
     end
   end

   class C
     def foo; end
     def bar; end

     include Interface
   end

   harp:~ > ruby a.rb
   a.rb:10:in `included': must have #foobar (RuntimeError)
           from a.rb:10:in `each'
           from a.rb:10:in `included'
           from a.rb:20:in `include'
           from a.rb:20

the built-in Enumerable module requires an interface - that of 'each' and '<=>'
and it seems successfull enough....

cheers.

-a
-- 
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| My religion is very simple.  My religion is kindness.
| --Tenzin Gyatso
===============================================================================