From: Sean O'Dell Date: 2003-11-21T07:31:33+09:00 Subject: Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types) ) On Thursday 20 November 2003 02:20 pm, Zach Dennis wrote: > Sean, > > >Actually, the new proposal only checks at compile-time, when a class which > >implements an interface is loaded, and whenever methods are added to the > >class. > > How can this be done efficiently with Ruby's dynamic nature at compile > time? > > I'm going to go read your proposal now. =) Because the checks are only done when methods are added to the class, which mostly means when the class is loading. Whenever a check for interface compliance is done, it's really just asking an object "do you fully implement this interface" and there are no calculations are performed. The object either carries a compliance flag or it doesn't. The compliance flag is assigned as soon as the last method required by the interface is loaded. Once a class is loaded, of course methods can be re-implemented, and objects can also re-implement the methods, so if the class or object has an interface requirement, the method will be checked at that time for compliance with the interface, but after that no calculations are performed; only the compliance flag is checked. Sean O'Dell