On Thursday 01 May 2008 06:35:12 John M. Dlugosz wrote: > chromatic chromatic-at-wgz.org |Perl 6| wrote:
> > This is why roles-as-types is so important: type inferencers can't infer > > allomorphism because allomorphism relies on explicitly-marked semantic > > meanings. > What is your nomenclature here? "vary in sound without changing its > meaning"? If I tell the type system that Foo and Bar are equivalent, then they're equivalent even if they have different internal structures and no other relationship in an inheritance sense. > What are marked semantic meanings? Types. That is, in the context of "Dog", "bark" means "emit a sound". In the context of "Tree", "bark" means "the outer skin". Because guessing that "bark" and "bark" are cognates doesn't work (duck typing's false cognates) and because the internal structures don't have to be the same between actual cognates, someone has to tell the type checker that two separate entities are polymorphically equivalent. That person is the programmer, and that mechanism is the declaration that one entity performs the role of the other, or both perform the same role, or one subclasses the other. Note that you can implement polymorphic equivalence marking through subclassing in terms of roles, not vice versa. Note also that any given entity may perform multiple roles. -- c