vvvvalvalval / scope-capture

Project your Clojure(Script) REPL into the same context as your code when it ran
MIT License
576 stars 14 forks source link

Eliminate compiler warnings in ClojureScript #19

Closed chpill closed 6 years ago

chpill commented 6 years ago

Following up on https://github.com/vvvvalvalval/scope-capture/issues/18

The warning about Throwable is very easy to get rid of (see diff).

The warning about the *file* dynamic variable less so... I don't know much about it except its doc. All I've learned for now is that earmuffs are really inconvenient when you look for them in search engines :sweat_smile: . I will dig deeper in the following days.

By the way, I use the following command to test the self-hosted clojurescript case (very primitive but convenient):

# at the root of the project
lumo --classpath src/ \
     --eval "(require '[sc.api :as sc]) (let [a 42] (sc/spy)) (sc/letsc [1 -1] (assert (= a 42)))"
vvvvalvalval commented 6 years ago

Re: *file*, I guess we could just use reader conditionals as well (AFAICT file is only defined for Clojure JVM).

chpill commented 6 years ago

As expected, this one was a bit more tricky, but it seems we now capture the file name correctly in all cases.

For self-hosted cljs, I tested with: lumo --classpath src/ --init lab/sc/lab/cljs/example.cljs (i have not tried with planck yet).

For the latest jvm cljs, I tested by adding the following deps.edn at the root of the project:

{:paths ["src"]
 :deps {org.clojure/clojurescript {:mvn/version "1.10.238"}}}

and running the following: clj --main cljs.main lab/sc/lab/cljs/example.cljs

We should probably write a proper cljs test file and run it in different environments, but that's a story for another PR :)

vvvvalvalval commented 6 years ago

Good, thanks!

I added an issue for CLJS testing: https://github.com/vvvvalvalval/scope-capture/issues/22

vvvvalvalval commented 6 years ago

@chpill Could you add an entry to the CHANGELOG? After that, ready to merge.

chpill commented 6 years ago

@vvvvalvalval :ok_hand: