Fork me on GitHub
#cursive
<
2021-08-19
>
cfleming05:08:07

(this is the IllegalArgumentException one)

imre09:08:52

cheers Colin, this appears to be working fine now

potetm14:08:39

Thanks Colin!

folcon09:08:54

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 馃槂...

imre09:08:25

send form sends a single form: either the one you have selected or the one before the caret

imre09:08:34

load file loads the entire file

imre09:08:48

i.e. all the forms in the file

cfleming09:08:47

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

cfleming09:08:04

Perhaps the Arcadia nREPL impl doesn鈥檛 implement that? Would seem weird though.

folcon10:08:41

I'll take a peek into the source, give me a sec

folcon10:08:39

Sure, I just was initially under the impression that load file was just sending multiple repl forms

folcon10:08:21

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

folcon10:08:37

It might be a nrepl version thing...

folcon10:08:52

Going to try and update the nrepl version and see if that helps 馃槂

folcon10:08:30

Hmm, it does say Error initialising locals clearing

folcon11:08:21

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

folcon11:08:54

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 馃槂

folcon11:08:46

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

folcon11:08:43

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...

folcon11:08:54

brb grabbing lunch

folcon15:08:26

Ok, still not figured much about how to fix the non-fully qualified names from just calling user namespace instead of their own namespace...

folcon16:08:11

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:

folcon18:08:55

Not sure if this is a cursive problem or an nrepl one?

folcon00:08:15

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!

cfleming00:08:48

That鈥檚 good timing, I was just at this very minute reading through your thread 馃檪

3
cfleming00:08:46

Things like the locals clearing might not work though, I don鈥檛 know if ClojureCLR (or MAGIC? not sure what Arcadia is using these days) supports that.

folcon00:08:46

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 馃槂...

folcon00:08:17

They're working on MAGIC from what I understand, with clojureCLR being what's used

folcon00:08:40

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 馃槂...

folcon00:08:19

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 馃槂...

ikitommi12:08:04

is it safe to update to IDEA 2021.1.3?

imre13:08:15

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

ikitommi12:08:35

any idea what this mean (shadow-cljs project):

cfleming21:08:06

Do you know where those files are coming from? Are they in your project or in libraries?

Ryan19:08:47

Hey all, is it sort of normal at present for a great many symbols to not resolve in cljs land?

thheller20:08:39

npm-related things yes, otherwise not so much. depends on the kinds of macros you use I guess.

Ryan20:08:31

hm I might have a bigger problem then because it cant resolve defn or let

Ryan20:08:52

I mean, the code is running, my code is just littered with yellow squiggly underlines 馃檪

thheller20:08:32

how did you load the project? usually this happens when the project wasn't created properly

Ryan20:08:46

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?

Ryan20:08:09

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!)

thheller20:08:58

I think that just creates a shadow-cljs.edn? then you can follow https://shadow-cljs.github.io/docs/UsersGuide.html#_cursive

Ryan20:08:20

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.

thheller20:08:21

creating a deps.edn is fine too, just don't have to if you don't intend to use it

Ryan20:08:40

the pom way seems better 馃檪

Ryan20:08:05

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

thheller20:08:51

only if you change :dependencies or :source-paths

thheller20:08:21

don't hardcode a nrepl port. not needed, cursive has an option to use the created nrepl port file

Ryan20:08:24

sure, I just grabbed the first keyword out of the map 馃檪 I guess that leiningen template did that, I haven't touched this file yet!

Ryan20:08:43

Thanks for all the help, this is such a nicer setup than the last project I worked on (angular 6鈥11, webpack etc etc)

馃憤 3