Clojure

enhance with-open to be extensible with a new close multimethod

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

Discussion: http://groups.google.com/group/clojure/browse_thread/thread/8e4e56f6fc65cc8e/618a893a5b2a5410

Currently, with-open calls .close when it's finished. I'd like it to have a (defmulti close type) so it's behavior is extensible. A standard method could be defined for java.io.Closeable and a :default method with no type hint. I've come across a few cases where some external library defines what is essentially a close method but names it shutdown or disable, etc., and adding my own "defmethod close" would be much easier than rewriting with-open. This would also allow people to eliminate reflection for classes like sql Connection that were created before Closeable.

Activity

Alex Miller made changes -
Field Original Value New Value
Fix Version/s Backlog [ 10035 ]
Approval Not Approved [ 10008 ]
Alex Miller made changes -
Priority Major [ 3 ]
Alex Miller made changes -
Labels io

People

  • Assignee:
    Unassigned
    Reporter:
    Anonymous
Vote (0)
Watch (2)

Dates

  • Created:
    Updated: