4 ms·
Pretty indepth stuff, it'd be useful if you point out why you even need the INode interface, unless I missed that.
by djb_hackernews 13y ago
Pretty indepth stuff, it'd be useful if you point out why you even need the INode interface, unless I missed that.
- Anderkent 13y ago`deftype` only lets you implement functions that match an interface, protocol, or override Object. It's meant to narrow down the meaning of a type, and usually any non-interface methods would just be clojure functions that take an object. It does play weirdly with the fact that mutable fields are private, I agree. But that is a very rare case, and in general you'd usually create a type to implement an interface or protocol. Quoting Rich Hickey: (https://groups.google.com/forum/#!msg/clojure/pZFl8gj1lMs/qVfIjQ4jDDMJ https://groups.google.com/forum/#!msg/clojure/pZFl8gj1lMs/qV...) "AOT deftype vs gen-class touches on the same Clojure semantics vs Java/ host semantics, with the objectives from before - support implementing interfaces but not concrete derivation. So, no concrete base classes, no super calls, self-ctor calls, statics, methods not implementing interface methods etc."
- johnwalker 13y agoThat's just the way records work in Clojure. Methods that are implemented within a record have to come after their interface.