Clojure

Support Abstract Base Classes with "reify"

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:

Description

Problem:

  • Various Java APIs depend on extension of abstract base classes rather than interfaces
  • "proxy" has limitations (no access to protected fields or super)
  • "proxy" has performance overhead because of an extra layer of functions / parameter boxing etc.
  • "gen-class" is complex and is complected with compilation / bytecode generation

In summary, Clojure does not currently have a good / convenient way to extend a Java abstract base class dynamically.

Proposal is to extend "reify" to allow a single abstract base class as well as 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). This change would be backwards-compatible with all existing uses of "reify".

Activity

People

Vote (2)
Watch (5)

Dates

  • Created:
    Updated: