This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-21
Channels
- # beginners (38)
- # boot (88)
- # cljs-dev (142)
- # cljsrn (2)
- # clojars (1)
- # clojure (107)
- # clojure-berlin (2)
- # clojure-italy (8)
- # clojure-russia (76)
- # clojure-spec (325)
- # clojure-taiwan (3)
- # clojure-uk (28)
- # clojurescript (80)
- # clojurewest (2)
- # core-async (36)
- # core-logic (1)
- # cursive (21)
- # datomic (16)
- # dirac (18)
- # docs (2)
- # emacs (1)
- # euroclojure (3)
- # garden (3)
- # gsoc (2)
- # hoplon (3)
- # immutant (4)
- # jobs-discuss (16)
- # lein-figwheel (5)
- # liberator (17)
- # lumo (19)
- # off-topic (2)
- # om (20)
- # onyx (28)
- # pedestal (50)
- # planck (4)
- # re-frame (5)
- # reagent (3)
- # ring-swagger (13)
- # spacemacs (1)
- # specter (43)
- # testing (3)
- # timbre (3)
- # uncomplicate (1)
- # vim (2)
- # yada (4)
Hi there! Given the two following Clojure files:
; file myprotocol.clj
(ns myprotocol)
(defprotocol MyProtocol
(method-one [this arg]))
; file mytype.clj
(ns mytype
(:require [myprotocol])
(:import [myprotocol MyProtocol]))
(deftype MyType []
MyProtocol
(method-one [_ arg] (str "arg is:" arg)))
Cursive is having issues resolving method-one
https://cl.ly/47383n1t370w
Any idea what's up?@pelletier When you’re implementing a protocol, you need an extra this
parameter.
I think the problem is that you don’t need the import. What you’re doing there is implementing the interface generated by the protocol, and the method there will be called method_one
.
I think you can delete the import, (:require [myprotocol :as p])
and then (deftype MyType [] p/MyProtocol ...)
It would probably be a good idea to have a warning that you’re implementing a protocol interface rather than the protocol itself.
The Tools->REPL menu acts weird on a lib when I try to run tests. Sometimes the action to run tests is enabled and sometimes not, sometimes I can move to the tests namespace in REPL and sometimes not. What's the surest way to make it work consistently? I don't mind adding a bunch of redundant configuration if necessary.
I've noticed in the most recent EAP's that Refresh Leiningen Projects only works when you are in a project.clj file
The old behaviour allowed it from anywhere (I think)
Is this an intentional change?