▲ | geokon 3 days ago | ||||||||||||||||
Mmm, I don't think what you're saying is true? I'll be honest I haven't touched Java in a long time, and I'm haven't had to extend my Clojure code this much before (but it's nice to know that I can - and use protocols with confidence) Say LibraryA has some record.. LibraryB and LibraryC `extend-type` the record and implement additional functionality by implementing protocols.. Now you want to us both libraries in your application and use this record with both extensions. In Java this is forbidden due to diamond dependencies restrictions. You can use multiple protocols in Java, but you can't have the protocols implemented (there are default methods but they don't have access to the Record's state) Is there some way around this..? As far as I understand there isn't. Furthermore, all the extensions need wrappers and need names. Nobody is doing this b/c you'd go nuts. But in Clojure it'd be a natural way to extend a library. For instance
I can keep using vectors and lists as before and have new functionality. I don't need a new wrapper to think about | |||||||||||||||||
▲ | roenxi 2 days ago | parent [-] | ||||||||||||||||
I can't claim to know much of anything about Java. But this sounds like it might be linked to Java's type system and Clojure is an untyped language. From what I know of typed languages I don't see how a Clojure style interface could be implemented in a typed language or why someone would want to do that if they have chosen a typed language. So I don't understand the point and I don't know Java. I'm fairly confident that Java is technically capable of doing anything Clojure can since in the extreme case someone could implement a Clojure library callable from Java. In a similar way to how the Python community claims to do machine learning despite all critical code actually being in C++. | |||||||||||||||||
|