At 09:42 AM 11/22/2006 -0700, Steven Bethard wrote: >Yeah, it certainly seems like in both this case and the string case, >there needs to be some shorthand for saying "implements all the basic >String/Number/whatever methods".
But we are probably better off composing such a concept *from* the methods, rather than having the concept be merely a container *of* methods. This is basically the difference between Java interfaces and Haskell's notion of "typeclasses". You can define typeclasses like "ordered" or "four-function arithmetic" and it's okay if they overlap, because they're defined in terms of the operations you can perform. So nothing prevents somebody else from making "six-function arithmetic", or "reversible strings" or whatever. And nobody has to *re*define their type as supporting these new "interfaces", as long as they have the requisite operations. So, if we have to have something like an interface, let's steal Haskell's version of the idea instead of Java's, because it involves a lot less typing. :) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com