Hi Mark! On Tue, Feb 18, 2014 at 11:36:13PM -0500, Mark Shimozono wrote: > Can I think of a sage category as an abstract > superclass that lives outside the usual class hierarchy, > but imposes structure on the instance, even to the point of > promising certain kinds of methods and so on, > which must possess certain properties?
Yes, one definitely should think about categories, or more precisely about their associated C.parent_class/C.element_class/..., as abstract classes. That's really what they are at the end: the only deviation is that the inheritance is set dynamically rather than statically. And then, as every abstract class, they impose a contract on their concrete subclasses, typically like specifying the existence, signature, and semantic of certain methods. > To be useful a category needs to have some "enforcement power". Yes! That's what "abstract_methods" and "_test_methods" are here for, even though this is not as rigid as what you can have with statically checked languages like java (e.g. the compiler barks if you don't override an abstract method having a given signature with a concrete method with the same signature). Cheers, Nicolas -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-combinat-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-combinat-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-combinat-devel. For more options, visit https://groups.google.com/groups/opt_out.