Fork me on GitHub
#cider
<
2017-12-22
>
gonewest81800:12:54

Can someone help figure out what’s going on? I’m trying to experiment with lib-grimoire in a repl, but I’m getting errors in a CIDER repl that don’t occur if I lein repl in a terminal.

gonewest81800:12:20

With lein repl:

gonewest81800:12:15

Neils-MBP:grimtest neilo$ lein repl
nREPL server started on port 61404 on host 127.0.0.1 - 
REPL-y 0.3.7, nREPL 0.2.13
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_112-b16
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (load "grimtest/core")
nil
user=> (in-ns 'grimtest.core)
#namespace[grimtest.core]
grimtest.core=> (gt/->Group "org.clojure")
#g/t [:grimoire.things/group {:name "org.clojure", :grimoire.things/url "org.clojure"}]
grimtest.core=> 

gonewest81800:12:34

In a CIDER repl:

gonewest81800:12:43

;; Connected to nREPL server - 
;; CIDER 0.15.1 (London), nREPL 0.2.13
;; Clojure 1.8.0, Java 1.8.0_112
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
;; ======================================================================

gonewest81800:12:40

C-c C-k to load grimtest/core.clj, and then C-c M-n to switch namespaces

gonewest81800:12:57

grimtest.core> (gt/->Group "org.clojure")
AbstractMethodError Method guten_tag/core/ATaggedVal.iterator()Ljava/util/Iterator; is abstract  guten-tag.core.ATaggedVal (core.clj:-1)
grimtest.core> 

gonewest81800:12:28

Same project.clj, same code, etc. What’s going on?

arrdem00:12:21

What Java version?

arrdem00:12:31

I'm the Grimoire author fyi

gonewest81800:12:38

1.8.0_112-b16

gonewest81800:12:51

And yes, nice to chat with you!

arrdem00:12:28

Soooo it may well be that guten tag is incomplete

arrdem00:12:37

Never seen that before

gonewest81800:12:27

… “incomplete” in what way?

arrdem00:12:05

That method may actually not be implemented

gonewest81800:12:17

… even if that were so, why would the exception occur only in a CIDER repl?

arrdem00:12:40

I'm guessing that CIDER may be doing some code reloading, and since the ATaggedVal type is defined in Clojure that could mess things up.

arrdem00:12:52

But that could be changed.

arrdem00:12:11

@gonewest818 can you publish your scratch repo somewhere?

arrdem00:12:38

yeaaaaah looking at that error message I bet this is code reloading.

gonewest81800:12:11

You can reconstruct the repo easily… it’s just lein new grimtest

gonewest81800:12:36

(defproject grimtest "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "Eclipse Public License"
            :url ""}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure-grimoire/lib-grimoire "0.10.9"]])

gonewest81800:12:05

and src/grimtest/core.clj:

gonewest81800:12:08

(ns grimtest.core
  (:require [grimoire.api.web :as g]
            [grimoire.things :as gt]))

gonewest81800:12:15

Literally, that’s it.

gonewest81800:12:45

I know, right?

arrdem00:12:37

;; Connected to nREPL server - 
;; CIDER 0.15.1 (London), nREPL 0.2.12
;; Clojure 1.9.0, Java 1.8.0_144
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/boolean?
WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/boolean?
user> (require '[grimoire.api.web :as g]
               '[grimoire.things :as gt])
nil
user> (gt/group "foo")
CompilerException java.lang.RuntimeException: No such var: gt/group, compiling:(*cider-repl lib-grimoire*:15:7) 
user> (gt/->group "foo")
IllegalArgumentException Multiple methods in multimethod 'simple-dispatch' match dispatch value: class guten_tag.core.ATaggedVal -> interface clojure.lang.IPersistentMap and interface clojure.lang.ISeq, and neither is preferred  clojure.lang.MultiFn.findAndCacheBestMethod (MultiFn.java:178)
user> 

gonewest81800:12:40

and for the record: Emacs 25.3, CIDER 0.15.1, nrepl 0.2.13 and Java 1.8.0_112

arrdem00:12:48

Apparently I'm not Clojure 1.9 friendly at any rate.

arrdem00:12:27

Oh no that's a pprint thing.

arrdem00:12:27

@gonewest818 works on my machine?

;; Connected to nREPL server - 
;; CIDER 0.15.1 (London), nREPL 0.2.12
;; Clojure 1.9.0, Java 1.8.0_144
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
user> (gt/->Group "org.clojure")
#g/t [:grimoire.things/group {:name "org.clojure", :grimoire.things/url "org.clojure"}]
user> (gt/->group "org.clojure")
#g/t [:grimoire.things/group {:name "org.clojure"}]
user> (print (slurp "project.clj"))
(defproject me.arrdem/scratch "0.1.0-SNAPSHOT"
  :description "Bits and bats. More bats than Detritus."
  :url ""
  :license {:name "Eclipse Public License"
            :url  ""}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure-grimoire/lib-grimoire "0.10.9"]]
  :profiles {:dev {:source-paths ["dev"]}})
nil
user> 

arrdem00:12:15

Clojure 1.9... trying on 1.8

arrdem00:12:02

;; Connected to nREPL server - 
;; CIDER 0.15.1 (London), nREPL 0.2.12
;; Clojure 1.8.0, Java 1.8.0_144
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
user> (gt/->Group "org.clojure")
#g/t [:grimoire.things/group {:name "org.clojure", :grimoire.things/url "org.clojure"}]
user> (gt/->group "org.clojure")
#g/t [:grimoire.things/group {:name "org.clojure"}]
user> (print (slurp "project.clj"))
(defproject me.arrdem/scratch "0.1.0-SNAPSHOT"
  :description "Bits and bats. More bats than Detritus."
  :url ""
  :license {:name "Eclipse Public License"
            :url  ""}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure-grimoire/lib-grimoire "0.10.9"]]
  :profiles {:dev {:source-paths ["dev"]}})
nil
user> 

gonewest81800:12:33

I’ll try dropping back to nREPL 0.2.12, or upgrading Java to 1.8.0_144… ?

gonewest81800:12:48

nREPL 0.2.12:

arrdem00:12:50

So this is definitely a bug in guten-tag

arrdem00:12:55

that method is abstract

arrdem00:12:05

and unimplemented.

arrdem00:12:09

unclear how you're encountering it tho

arrdem00:12:21

are you using fipp or something as a pretty-printer?

gonewest81800:12:58

actually, yes

;; pretty printing (via fipp, the default)
(setq cider-repl-use-pretty-printing 't)
(setq cider-pprint-fn 'fipp)

arrdem00:12:06

Yep. That'll do it.

arrdem00:12:49

So fipp sees that the guten-tag ATaggedVal is in theory java.lang.Iterable and so tries to call .iterator which isn't implemented and boom

gonewest81800:12:43

Yep, that was it. (setq cider-repl-use-pretty-printing nil)

arrdem00:12:01

Lemme implement that method and push rl quick

arrdem00:12:15

you'll have to depend on guten-tag explicitly to bump the depended version but it'll work

gonewest81800:12:28

cool. thanks.

arrdem00:12:22

I have a patch I just want to do the book keeping around this

arrdem00:12:58

@gonewest818 [me.arrdem/guten-tag "0.1.7"] done.

gonewest81800:12:08

was afk for a few minutes… do you still need the issue?

gonewest81800:12:23

ok, patch is confirmed, thanks!

arrdem00:12:22

Sorry about that, lemme know if you have any trouble with lib-grim or notice any particular design flaws.

arrdem01:12:29

I'm not working on it right now but it's high on my list once I circle back from trying to shave the doc writing yak.

gonewest81801:12:28

ok, will do. The reason I’m looking at this is because of an earlier discussion in this channel. Someone asked if it would be possible to modify cider-grimoire.el to read from a cached copy of the docs to make the lookups more responsive. bbatsov suggested doing that as nrepl middleware so that the same feature would be (at least in theory) accessible to atom and vim etc. And I thought I would have a try at that.

arrdem01:12:49

Yeah so you're gonna have to touch most of this then.

gonewest81801:12:38

grimtest.core> (-> ""
                   grimoire.api.web/->Config
                   grimoire.api/list-groups)
IllegalArgumentException No method in multimethod '-list-groups' for dispatch value: :grimoire.api.web/Config  clojure.lang.MultiFn.getFn (MultiFn.java:156)

arrdem01:12:14

Have you loaded the web backend?

arrdem01:12:18

the curse of multimethods >.>

arrdem01:12:47

(require 'grimoire.api.web) ;; purely for side-effects >.>

gonewest81801:12:58

[grimoire.api.web :as web]

arrdem01:12:29

you do have to require grimoire.api.web.read for side-effects. sorry, web is just a couple ctors.

zlrth01:12:28

is it the case that one cannot (cider-debug-defun-at-point) (i.e. instrument) core.async code? and is the most up-to-date workaround ztellman's riddley[0]? my context for this is this github issue: https://github.com/clojure-emacs/cider/issues/1775 [0] https://github.com/ztellman/riddley

bozhidar07:12:09

@mfm Yeah, unfortunately no one has worked on this for a while.

bozhidar07:12:11

@gonewest818 Happy to see you’re working on this!

dominicm09:12:03

@gonewest818 Really excited to see progress on this also!

bherrmann13:12:01

starting a fresh 1.9 project. " $ lein repl " works fine. Updated cider. Get an error when doing 'cider-jack-in' Starting nREPL server via /home/bob/bin/lein update-in :dependencies conj \[org.clojure/tools.nrepl\ \"0.2.13\"\ \:exclusions\ \[org.clojure/clojure\]\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.16.0-SNAPSHOT\"\] -- with-profile +jetty repl... ... error in process filter: cider--connections-refresh: Invalid function: (buffer (get-buffer cider--connection-browser-buffer-name)) error in process filter: Invalid function: (buffer (get-buffer cider--connection-browser-buffer-name))

bherrmann14:12:32

This was because I was running cider from "melpa" (aka cider 20171220.135) and not "stable.melpa" (aka cider 0.15.1).

bozhidar14:12:13

Hmm, 0.16 works for me just fine. Normally you’d get such an error if there was some issue on the Elisp side of things. You can also toggle nREPL message logging in CIDER and try to connect again to see what’s happening in the log.

bherrmann14:12:33

ok, I'm game... stable is for the weak.

bherrmann14:12:38

Install package ‘cider-20171220.135’? (y or n) y

bherrmann14:12:17

Huh. Damn if it didnt just start up fine.

arrdem20:12:39

Meanwhile, progress on some docs-as-data ideas https://twitter.com/arrdem/status/944294272496410625

bozhidar21:12:04

@bherrmann That’s a pretty common scenario. 😄

bozhidar21:12:18

That would make it much easier to properly format the docs in editors.