planck

Planck ClojureScript REPL
moxaj 2017-07-21T15:34:18.562305Z

@mfikes if you have planck at hand, could you try evaluating (require 'clojure.tools.reader) in the repl? Throws for me in lumo, but I have a hunch it's a bug upstream

2017-07-21T15:40:42.782093Z

@moxaj

cljs.user=> (require 'clojure.tools.reader)
nil

moxaj 2017-07-21T15:41:14.800176Z

@bfabry might need a fairly recent clojurescript, forgot to add

2017-07-21T15:41:16.801767Z

sorry should've given all

11326-storage:link_dataflow bfabry$ planck
Planck 2.5.0
ClojureScript 1.9.562
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
    Exit: Control+D or :cljs/quit or exit or quit
 Results: Stored in vars *1, *2, *3, an exception in *e

cljs.user=> (require 'clojure.tools.reader)
nil

moxaj 2017-07-21T15:42:03.828204Z

yes, I have my eyes on CLJS-2069, which was fixed in 1.9.655

2017-07-21T15:42:49.853742Z

ah

mfikes 2017-07-21T15:49:17.074365Z

@moxaj It is broken with Planck against ClojureScript master:

cljs.user=> (require 'clojure.tools.reader)
No such macros namespace: cljs.tools.reader, could not locate cljs/tools/reader.clj or cljs/tools/reader.cljc
cljs.user=> *clojurescript-version*
"1.9.820"

moxaj 2017-07-21T15:49:57.095940Z

alright, thanks for checking, gonna log a jira

mfikes 2017-07-21T15:51:17.140921Z

@moxaj Perhaps a minimal self-host repro can be trivially produced with https://clojurescript.org/community/reporting-bootstrap-issues

moxaj 2017-07-21T15:51:37.151612Z

I was looking at one of your self host tickets

moxaj 2017-07-21T15:51:45.155779Z

https://dev.clojure.org/jira/browse/CLJS-2261

moxaj 2017-07-21T15:52:32.181507Z

(require 'cljs.js)

(cljs.js/eval-str (cljs.js/empty-state)
                  "(ns cljs.user (:require [clojure.tools.reader]))"
                  nil
                  {:eval cljs.js/js-eval}
                  println)

moxaj 2017-07-21T15:52:36.183627Z

I think this is good enough?

mfikes 2017-07-21T15:52:44.187717Z

@moxaj Right, that is a more complicated regression where you actually need to handle code loading. I bet the single-form version on the site works for this, since it is just a require form.

mfikes 2017-07-21T15:53:16.205757Z

Yes, if that repro’s. A slightly more minimal version is to replace the ns with (require 'clojure.tools.reader)

moxaj 2017-07-21T15:53:34.215646Z

that repros for me, in lumo at least

moxaj 2017-07-21T15:53:46.222586Z

and lumo shouldn't interfere in that, so probably not lumo specific

mfikes 2017-07-21T15:53:50.224709Z

You may need to add :context :expr

mfikes 2017-07-21T15:54:50.256843Z

You want to ensure it repros with java -jar cljs.jar -m cljs.repl.nashorn ideally

moxaj 2017-07-21T16:28:00.325172Z

@mfikes I think I got it:

(require 'cljs.js)

(cljs.js/eval-str (cljs.js/empty-state)
                  "(require 'clojure.x)"
                  nil
                  {:eval cljs.js/js-eval
                   :load (fn [{:keys [name macros]} cb]
                           (cb (when (and (= name 'cljs.x)
                                          (not macros))
                                 {:lang   :clj
                                  :source "(ns cljs.x)"})))}
                  println)

moxaj 2017-07-21T16:28:05.327761Z

with this, it repros in nashorn

moxaj 2017-07-21T16:30:11.393830Z

hope i'm using load-fn right, thinking of the (not macros) part. I'd assume this should not trigger loading cljs.x as a macros namespaces (but it tries to, hence the error)

mfikes 2017-07-21T16:32:32.468256Z

Hmm @moxaj, what you are doing there is returning ‘cljs.x for ‘clojure.x

mfikes 2017-07-21T16:32:48.475826Z

That’s not how cljs.js actually works

mfikes 2017-07-21T16:33:22.493052Z

It will first try loading 'clojure.x and that is supposed to fail, and then cljs.js will fall back to 'cljs.x

moxaj 2017-07-21T16:33:38.501160Z

(and (= name 'cljs.x))

moxaj 2017-07-21T16:33:50.506891Z

it'll fail at the first try

mfikes 2017-07-21T16:33:50.507388Z

Oh, right 🙂

moxaj 2017-07-21T16:34:17.520337Z

with verbose, I see the exact same debug messages as with lumo

mfikes 2017-07-21T16:34:18.520929Z

So, with that small repo, it should be possible to bisect now 🙂

moxaj 2017-07-21T16:34:26.525045Z

on it!

mfikes 2017-07-21T16:34:38.530813Z

Or, more importantly, we should be able to see whether your repro successfully worked in the past

mfikes 2017-07-21T16:34:58.541151Z

Just download an older cljs.jar and try it

moxaj 2017-07-21T16:35:29.557200Z

yep, i'll try 1.9.562

moxaj 2017-07-21T16:37:40.621771Z

it works

mfikes 2017-07-21T16:38:25.644459Z

Interestingly, you can see a hint of how it derails in 1.9.660:

(cljs.js/eval-str (cljs.js/empty-state)
                  "(require 'clojure.x)"
                  nil
                  {:eval cljs.js/js-eval
                   :load (fn [{:keys [name macros]} cb]
           (prn name macros)
                           (cb (when (and (= name 'cljs.x)
                                          (not macros))
                                 {:lang   :clj
                                  :source "(ns cljs.x)"})))}
                  println)
clojure.x nil
cljs.x true
{:error #error {:message No such macros namespace: cljs.x, could not locate cljs/x.clj or cljs/x.cljc, :data {:tag :cljs/analysis-error}}}
nil

mfikes 2017-07-21T16:38:51.656708Z

It seems to jump to falling back to a macros namespace!

mfikes 2017-07-21T16:39:21.671290Z

That aint right 🙂

moxaj 2017-07-21T16:39:47.683750Z

that's what I see in lumo and 1.9.671 as well

mfikes 2017-07-21T16:39:54.687110Z

But yes, @moxaj I think that’s a good minimal (REPL-driven) repro, very useful for bisecting on as well

moxaj 2017-07-21T16:39:59.689364Z

that true shouldn't be there

mfikes 2017-07-21T16:40:22.701033Z

Yes, I bet in 1.9.562 it trys with a falsey value for macros

moxaj 2017-07-21T16:44:53.834137Z

oh, if I wasn't on windows 😞. I don't see any windows equivalent for script/clean && script/bootstrap && rm -rf .cljs_node_repl && script/noderepljs

moxaj 2017-07-21T16:45:06.840928Z

there's a repljs.bat, but that's it

moxaj 2017-07-21T16:49:22.968021Z

I'll follow https://github.com/clojure/clojurescript/wiki/Windows-Setup

mfikes 2017-07-21T16:51:30.032392Z

There is script\bootstrap.ps1, and yes, script\repljs.bat. You can probably figure out the way to remove the .cljs_node_repl tree, and the one last bit missing is a Windows version of script/clean

moxaj 2017-07-21T16:52:15.054876Z

seems easy enough to port

mfikes 2017-07-21T16:52:20.057438Z

Oh, just look at the contents of script/clean @moxaj , you could probably write a bat file that does that

mfikes 2017-07-21T16:52:34.064370Z

It is just deleting various trees

mfikes 2017-07-21T16:52:41.067814Z

And files

moxaj 2017-07-21T18:12:42.498278Z

@mfikes fyi https://dev.clojure.org/jira/browse/CLJS-2266

mfikes 2017-07-21T18:13:15.514808Z

Awesome. Great job!

moxaj 2017-07-21T18:21:12.749695Z

thanks!

moxaj 2017-07-21T18:28:04.953745Z

wouldn't it be nice if the scripts were cljs scripts ran with planck/lumo 🙂 would be really meta

mfikes 2017-07-21T18:29:55.009092Z

Right! Planck does that, especially for the scripts that drive its tests.

mfikes 2017-07-21T18:30:58.042562Z

But, that would be a dep in ClojureScript that wouldn’t be desired, I would guess. It would make the script portable, on the other hand 🙂

moxaj 2017-07-21T18:32:14.081018Z

there could be a small shell/powershell script which bootstraps planck/lumo, which then would bootstrap cljs

mfikes 2017-07-21T18:32:33.091032Z

Hah!

mfikes 2017-07-21T18:33:27.118295Z

I am intrigued with the implication of Alex Miller’s deps talk might be with respect to easily firing up Clojure-based scripts.

moxaj 2017-07-21T18:35:45.188704Z

is that published online somewhere? really looking forward to watching it

moxaj 2017-07-21T18:36:48.219970Z

oh, misread your sentence, you haven't seen it either

mfikes 2017-07-21T19:04:04.016817Z

Right, I’m awaiting them to start flowing onto YouTube

anmonteiro 2017-07-21T20:51:16.736089Z

@mfikes last year it took a couple months