[CLJ-1255] Support Abstract Base Classes with Java-only variant of "reify" Created: 06/Sep/13 Updated: 15/May/17
|Affects Version/s:||Release 1.6|
In summary: Clojure does not currently have a good / convenient way to extend a Java abstract base class dynamically.
The proposal is to create a variant of "reify" that allows the extension of a single abstract base class (optionally also with interfaces/protocols). Code generation would occur as if the abstract base class had been directly extended in Java (i.e. with full access to protected members and with fully type-hinted fields).
Since this is a JVM-only construct, it should not affect the portable extension methods in Clojure (deftype etc.). We propose that it is placed in an separate namespace that could become the home for other JVM-specific interop functionality, e.g. "clojure.java.interop"
Proposed solution: The attached patch proposes an implementation for this feature, providing a new `clojure.interop` namespace, containing the `defclass` and `extend-class` macros.
|Comment by Alex Miller [ 30/Jun/14 8:18 AM ]|
From Rich: we do not want to support abstract classes in a portable construct (reify, deftype). However, this would be considered as a new Java-only construct (extend-class or reify-class). If you could modify the ticket appropriately, will move back to Triaged.
|Comment by Nicola Mometto [ 15/May/17 3:19 PM ]|
Attached a proposed impl for this feature
|Comment by Nicola Mometto [ 15/May/17 3:22 PM ]|
More documentation about the proposed impmlementation can be found at https://docs.google.com/document/d/1OcewjSpxmeFRQ3TizcaRRwlV34T8wl4wVED138FHFFE, non squashed commits at https://github.com/clojure/clojure/compare/master...Bronsa:defclass