[CLJ-982] Implement an interface? predicate to balance class? Created: 04/May/12 Updated: 09/Jun/12 Resolved: 08/Jun/12 |
|
| Status: | Closed |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.5 |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | David Rupp | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | enhancement, patch, test | ||
| Environment: |
Any |
||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
clojure.core implements a class? predicate to detect if a thing is an instance of java.lang.Class. The attached patch implements interface? to further distinguish classes that are also interfaces. This gives us Clojure api for e.g., enumerating all interfaces a thing's base class implements; as in, (filter #(interface? %) (supers (class my-thing))). |
| Comments |
| Comment by Stuart Halloway [ 08/Jun/12 12:28 PM ] |
|
I would prefer to see this, and other interop/reflective items, in a separate contrib lib. |
| Comment by David Rupp [ 09/Jun/12 9:08 AM ] |
|
Thanks for the feedback, Stu. Is there an existing contrib lib for stuff like this? Or should I create one? |