This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-23
Channels
- # arachne (3)
- # aws (1)
- # bangalore-clj (2)
- # beginners (19)
- # boot (151)
- # cider (72)
- # cljs-dev (9)
- # cljsjs (7)
- # cljsrn (37)
- # clojure (215)
- # clojure-austin (1)
- # clojure-denmark (2)
- # clojure-dev (68)
- # clojure-india (1)
- # clojure-ireland (2)
- # clojure-italy (4)
- # clojure-mke (1)
- # clojure-nl (4)
- # clojure-russia (4)
- # clojure-serbia (1)
- # clojure-spec (29)
- # clojure-uk (23)
- # clojurescript (23)
- # cursive (24)
- # datomic (71)
- # emacs (5)
- # events (1)
- # gsoc (11)
- # hoplon (20)
- # klipse (4)
- # lambdaisland (2)
- # leiningen (3)
- # luminus (3)
- # off-topic (30)
- # om (40)
- # om-next (1)
- # onyx (15)
- # pedestal (19)
- # perun (7)
- # planck (23)
- # proton (1)
- # protorepl (2)
- # re-frame (35)
- # reagent (21)
- # ring-swagger (38)
- # rum (19)
- # spacemacs (9)
- # untangled (11)
- # vim (5)
- # yada (4)
@bronsa trying to figure out if this me being crazy or if it’s something that should work. Given a namespace:
(ns foo (:import [java.nio.file StandardWatchEventKinds]))
(def a StandardWatchEventKinds/ENTRY_CREATE)
if I
(anj/analyze-ns ‘foo)
I get:
CompilerException clojure.lang.ExceptionInfo: No such namespace: StandardWatchEventKinds {:ns StandardWatchEventKinds, :form StandardWatchEventKinds/ENTRY_CREATE…
@alexmiller I can't see why that shouldn't work, I'll take a look now
I just tried in a different repl env and it worked … hrm
I wonder if I’m getting java 6 somehow where it’s not available
yeah I'd be very surprised if that didn't work at all -- everything would've been broken then :)
see prior comment re being crazy :)
well import doesn’t load now right?
analyze+ns puts the thrown exception in the returned map as an ExceptionThrown object in the :result
key
it might be that an exception did get thrown while evaluating the ns
form but analyze+ns just kept on analyzing & failed on analysis of the next form
I still have it - I’m in Cursive and I reliably get this
did not see it running lein repl from same project
can you just do something like (->> (try (analyze-ns 'foo) (catch Exception _)) (map :result)))
If I remove the second line, the analyze-ns succeeds
or just analyze the first form and see if that has an ExceptionThrown object as its :result
no, nil :result
although ns expands to a do form that explicitly returns nil
so might be buried inside
nah, no errors in there
I think the ns line succeeds
t.a.jvm should definitely provide a way of handling this better, I'll have a think about it
still not sure I get how the class is not found in the first place
but I think that’s a cursive question
if you wrap your ns
form in like a (let [] ..)
you'll get the ExceptionThrown in the top-level map -- it's not there but in a deeper node because of the do
unrolling thing
@alexmiller yeah dunno, t.a.jvm uses (RT/makeClassLoader)
to get the classloader it uses to analyze/evaluate forms
yeah, I assume that has something to do with it, but I’m not observing that
java 8 classes on the boot classpath etc
I was also able to trigger it by just pulling the import out of the ns
smallest repro case should be (with-bindings {clojure.lang.Compiler/LOADER (clojure.lang.RT/makeClassLoader)} (eval '(import 'java.nio.file.StandardWatchEventKinds)))
it doesn’t throw :)
http://dev.clojure.org/jira/browse/TANAL-120 http://dev.clojure.org/jira/browse/TANAL-121
I’m continuing to try things in both environments and see things that make no sense
I will prob poke at it some more to see if I can make it make sense :)
yeah I'm reasonably sure there's a classloader issue at play there -- I've only ever run t.a.jvm from lein or java -cp and never had those issues, it's possible that cursive does something completely legal with classloaders but that I simply never incurred into & t.a.jvm doesn't handle it
@bronsa @alexmiller Actually only old IntelliJ versions use Java 6 these days - 2016 versions on mandate Java 8.
I don’t do anything very strange with classloaders in the REPL, I can’t see why that would fail or act differently.
Also, the Java 6 thing was for IntelliJ itself, not for user processes - they could always use whichever JVM they wanted.
yeah, it’s not obvious to me what the difference is
I do definitely see different behavior between the Cursive repl and a lein repl though
I feel like I’m seeing possibly bad state lingering in *env*
too maybe?
where once something fails, I get subsequent failures that I do not expect
I will try to isolate it a little better
I am using IntelliJ 2016.3.2 and Cursive 1.4.3
well t.a.jvm fallsback to the mutable namespace system of clojure so if that gets into a bad state so will subsequent calls of analyze-ns
So the funky bit about Cursive REPLs is that I invoke lein in trampoline mode in order to get the REPL classpath. That has caused issues because that’s done in the IntelliJ process, and hence with its JVM. However once the classpath is created, I just run it like any other process and don’t do anything else IIRC. So unless there are some classloader issues causing the REPL classpath to be created incorrectly, I’m not sure what could be going on.