On Nov 5, 2008, at 11:12, mb wrote: > I don't think that there are first-class and second-class citizens. > They just have a different aspect.
Right, one can't say one is superior to the other. There are just two separate worlds, each having its own characteristics. > Having pure Clojure "classes" with > multimethods might well be integrated and nice, but you get problems > when you have to interface to Java. On the other hand using Java > classes gives you easy interface, but you have to live with gen-class. But does gen-class have to look the way it does? Couldn't the same functionality be provided in a way that looks more like a proper part of the language? > What would interesting, is the question, whether both approaches > could be combined. We make a Java class (via gen-class), which > gets a default implementation for each method, which references > a similar named multimethod instead of the Class-methodName. That sounds like an interesting idea. > For the built-in datatypes: I implemented nth and get as multimethods > (as some kind of proof-of-concept), but Rich was not very interested > due to performance issues and the fact, that the datatypes are used > internally in very low-level areas. I can understand performance arguments, of course. And I don't really want to modify the built-in types in any way, I just want to be able to use the same interfaces in completely independent datatype implementations. The current implementation of nth provides a special implementation for each kind of datatype that it knows about, and fails for unknown types. Shouldn't it be possible to add a default case at the end that calls a Clojure multimethod? That shouldn't have any performance impact on the built-in datatypes. > I don't really follow the argument about monkey patching. I think > it's not monkey patching at all, since > the multimethods only define the interface. I agree. It's no more monkey-patching than any use of multimethods would be monkey-patching. Konrad. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---