plumatic / plumbing

Prismatic's Clojure(Script) utility belt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

defnk doesn't seem to support output annotation schemas including a protocol

emidln opened this issue · comments

Code of the form:

    (defnk foo :- {:bar Bar}
        "docstring"
        [quux :- s/Any])

doesn't compile under Clojure 1.6. Declaring that the output will satisfy Bar directly seems to be fine, as does including Bar as an input annotation. I compiled some examples in this gist.

https://gist.github.com/emidln/2b3a192b7e7f3d305f94

Am I doing something wrong here?

The fact that :- Foo works is a historical artifact -- the correct way is (s/protocol Foo), which should work in all of these case. Or if you want to refer only to things that instance? Foo (but not catch extenders), you can refer to the interface like my.ns.Foo (which is shadowed by the var my.ns/Foo).

Thanks! Should I leave this open?

Did you find a mention of hinting with a bare protocol in the documentation? If so, that's an issue -- otherwise, please close it. Thanks!