> - Herwig Holchleitner: how would that solution with protocols be? I write > a protocol that defines methods like `get` and `duplicate` and extend it > for each buffer, delegating the methods to their specific implementations? > ie, (defprotocol UnifiedBuffers (get [buff] "get data from buf") (duplicate > [buff] "duplicates buff")), (extend-protocol UnifiedBuffers ....ByteBuffer > (get [buff] (.get buff)) ....LongBuffer (get [buff] (.get buff))....)? > > exactly!
> - David: about the solution you propose, is it somehow considered > "cleaner" or "faster" or "more idiomatic" or, in any way, "better" than the > solution I'm proposing? The advantages might be way more subtle than my > small knowledge of Clojure allow me to understand -- I'm new in the Clojure > community, I might be missing some common idioms. I'd be glad if you could > expand on that! > > David's solution is more decomposed. You get the full speed of hinted types without needing to worry about macro stuff like double eval and with the generated code being first-class and reusable. kind regards -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. 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
