This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-19
Channels
- # announcements (15)
- # babashka (4)
- # beginners (55)
- # calva (92)
- # cider (70)
- # circleci (1)
- # clj-kondo (136)
- # cljdoc (2)
- # clojars (11)
- # clojure (48)
- # clojure-australia (1)
- # clojure-europe (30)
- # clojure-nl (3)
- # clojure-sweden (2)
- # clojure-uk (7)
- # clojurescript (40)
- # conjure (5)
- # core-async (11)
- # cursive (55)
- # data-science (1)
- # datomic (10)
- # degree9 (2)
- # development-containers (15)
- # events (1)
- # fulcro (14)
- # gratitude (13)
- # helix (5)
- # lsp (35)
- # malli (10)
- # meander (18)
- # off-topic (24)
- # pathom (13)
- # polylith (12)
- # practicalli (6)
- # re-frame (13)
- # reagent (33)
- # reitit (4)
- # remote-jobs (1)
- # shadow-cljs (13)
- # spacemacs (31)
- # specter (1)
- # stepwise (2)
- # tools-deps (19)
- # vim (1)
- # xtdb (7)
So I'm curious, what's the difference between send form to repl
and load file in repl
? I've been using cursive with arcadia, which granted is a bit outside the norm and send form to repl seems to work perfectly, but load file in repl
seems to not do anything? Is that calling some internal nrepl function? Knowing this would be useful as it might lead to fixing cursive functionality in terms of REPL workflow 😃...
send form sends a single form: either the one you have selected or the one before the caret
Right, and if your REPL is using nREPL, that will use the load-file op: https://nrepl.org/nrepl/0.8/ops.html#load-file
Sure, I just was initially under the impression that load file was just sending multiple repl forms
Hmm, it just seems to proxy the messages across, so I have no idea why it's failing... https://github.com/eponai/tools.cursive-arcadia-repl/blob/master/src/eponai/tools/cursive_arcadia_repl.clj
Ok, this is just weird, calling (ns-publics 'game)
gives the functions in question, but using send form to repl within the namespace does not work at all...
It's like send form to repl is still invoking the function in the user namespace even though I'm in the game
namespace...
Even fully qualifying the name doesn't work
Ok, I've created a mock function that just prints out the name in the user
ns and it now returns that instead. Looking at the nrepl messages, the :ns
key is not being set when I call send form to repl. Hmm, let's see if that's not being set at all or if the nrepl bridge is making a mistake 😃
Ok, passing the :ns key in the transport layer seems to make fully qualified names work, but not just calling the function and sending it's form across
Sorry if this is out of scope, but so far it sends the:
:id :op :ns :code
as well as the :file :file-name :file-path
when those are available
Not sure if some other data is required? No idea why the non-fully qualified name is causing this issue where send form to repl for the function call calls the function inside the current namespace instead of within the ns of the file it's in...
This doesn't even work if I change namespaces away from user...
Ok, still not figured much about how to fix the non-fully qualified names from just calling user
namespace instead of their own namespace...
Just so that it's clear: This is the "game" code:
;; game.core.clj
(ns game.core
(:require [arcadia.core :as arc])
(:import (UnityEngine GameObject)))
(defn log-name [obj role-key]
(arc/log (.name obj)))
(def mainObject (atom nil))
(defn create-main []
(swap! mainObject (fn [n] (new UnityEngine.GameObject "Main"))))
(defn hook-main []
(arc/hook+
@mainObject
:start
:log-name
;; in log-name `obj` will be the `the-object`, `role-key` will be `:log-name`
#'log-name))
;; user.clj
(defn hook-main []
(println "THIS IS THE WRONG ONE!"))
This is what happens =)...:
(create-main)
=> System.InvalidOperationException unable to resolve symbol: create-main in this context
clojure.lang.Compiler.ResolveIn (clojure.lang.Namespace, clojure.lang.Symbol, System.Boolean)
clojure.lang.Compiler.Resolve (clojure.lang.Symbol)
clojure.lang.Compiler.AnalyzeSymbol (clojure.lang.Symbol)
clojure.lang.Compiler.Analyze (clojure.lang.CljCompiler.Ast.ParserContext, object, System.string)
(game.core/create-main)
=> #<Main (UnityEngine.GameObject)>
(hook-main)
THIS IS THE WRONG ONE!
=> nil
(game.core/hook-main)
=> #'game.core/log-name
(in-ns 'game.core)
=> #object[Namespace 0xa0757000 "game.core"]
(hook-main)
THIS IS THE WRONG ONE!
=> nil
Calling the unqualified function just calls the hook-main
within the user namespace, even though the nrepl call is going to the correct namespace...
Even switching namespaces doesn't appear to help
I've made one minor edit to tools.cursive-arcadia-repl
, which I've forked here:
It's an nrepl server implementation problem it turns out, got a PR here: https://github.com/arcadia-unity/Arcadia/pull/386 I'm trying to figure out what else needs to be done to get cursive compatibility in a good place 😃... Advice appreciated!
Things like the locals clearing might not work though, I don’t know if ClojureCLR (or MAGIC? not sure what Arcadia is using these days) supports that.
It's pretty late where I am, but I'd really like this to work better, I get the impression that a fair few people who want to use arcadia also are wanting to use cursive, it seems to work fairly well barring a few issues 😃...
What would be helpful is having a clear idea exactly what the behaviour should be, I'm not sure how the nrepl implementation they've got working was written (did they just rewrite an old version of nrepl?), but it's only somewhat adherent to nrepl's protocol, so working with cursive exposes some holes. I've put in the PR that I linked things I'm a little unsure of with regards to how it should work as I don't know the exact order stuff should evaluate in 😃...
I suspect there's subtle gotchas in this space, if there's any obvious issues I'd be grateful if you can point them out so the PR can be worked on / improved 😃...
I used that for a while before upgrading to 2021.2 and had no issues with it. However, when trying to upgrade to .2, I ran into some conflicts and had to reinstall idea. Details are at https://youtrack.jetbrains.com/issue/IDEA-274515 The tl;dr; is something like 2021.1.3 having been rebuilt and republished to fix an issue I would consider 2021.1.3 safe now
looks very similar to: https://clojurians.slack.com/archives/C0744GXCJ/p1628499337053900
Do you know where those files are coming from? Are they in your project or in libraries?
You could try this (from that thread) to get more info: https://clojurians.slack.com/archives/C0744GXCJ/p1628849897090400?thread_ts=1628499337.053900&cid=C0744GXCJ
Hey all, is it sort of normal at present for a great many symbols to not resolve in cljs land?
npm-related things yes, otherwise not so much. depends on the kinds of macros you use I guess.
how did you load the project? usually this happens when the project wasn't created properly
So I used the re-frame template project for leiningen, and I guess that process does not actually create a leiningen project file nor a deps.edn file for the project, or maybe I deleted it in haste?
either way, I've created a deps.edn file, deleted and re-added the module (it was a web module so.. all sorts of things were wrong!)
I think that just creates a shadow-cljs.edn
? then you can follow https://shadow-cljs.github.io/docs/UsersGuide.html#_cursive
Yeah, it was very odd to me that a leiningen generator did not create a project manifest for itself, but I'm still trying to understand all the tooling.
Does that periodically need to be re-ran? like if I were to.. say.. change the nrepl port? not that I'd ever need to
don't hardcode a nrepl port. not needed, cursive has an option to use the created nrepl port file