From: Paul Brannan Date: 2003-01-03T01:06:37+09:00 Subject: Re: Interfaces in Ruby On Thu, Jan 02, 2003 at 11:49:55PM +0900, Robert wrote: > since ruby is dynamically type in principle there is no technical need for > interfaces. however, if i want to define an interface - say for reasons of > documentation - what is the suggested way to do so? create a class with a > set of methods returning 'nil' or 'self'? or create a method, that checks > the interface of an instance and raises a TypeError if any of the methods is > missing? what would you suggest? Make sure whatever mechanism you use is a module and not a class. Ruby only has single inheritance, so if it's a class, then I can't get both your interface and inherit from another class. See some discussion on this at (at the bottom under Abstract Base Classes): http://www.rubygarden.org/ruby?RubyFromCpp See also an earlier thread on this list starting at [ruby-talk:53297]. Paul