[CLJ-845] Unexpected interaction between protocol extension and namespaced method keyword/symbols Created: 29/Sep/11 Updated: 01/Mar/13 Resolved: 16/Dec/11 |
|
| Status: | Closed |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.3 |
| Fix Version/s: | Release 1.4 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Alexander Taggart | Assignee: | Alexander Taggart |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Ok |
| Description |
|
If the keywords of a protocol's method map are namespaced, the map is accepted, but lookup fails since lookup uses non-namespaced keywords. See Work-around for namespaced keywords with extend: Work-around for syntax-quoting with extend-type or extend-protocol: Possible solutions:
|
| Comments |
| Comment by Alexander Taggart [ 29/Sep/11 8:01 PM ] |
|
Simple test case to see the issue. => (defprotocol P
(self [p]))
P
=> (extend String
P
{::self identity})
nil
=> (self "foo")
#<IllegalArgumentException java.lang.IllegalArgumentException: No implementation of method: :self of protocol: #'user/P found for class: java.lang.String>
=> (defmacro try-extend-type [c]
`(extend-type String
P
(self [p#] p#)))
#'user/try-extend-type
=> (try-extend-type String)
nil
=> (self "foo")
#<IllegalArgumentException java.lang.IllegalArgumentException: No implementation of method: :self of protocol: #'user/P found for class: java.lang.String>
=> (keys (get-in P [:impls String]))
(:user/self)
|
| Comment by Rich Hickey [ 07/Oct/11 7:28 AM ] |
|
Most of this is a non-issue. :self and :foo/self are not the same. This: "Inside emit-hinted-impl, only grab name portion of symbols before converting to keyword." is the only needed change. |
| Comment by Stuart Sierra [ 09/Dec/11 3:26 PM ] |
|
Screened. |