Clojurians
#cljs-dev
<
2018-02-16
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

dnolen00:02:00

two line change, testing now

dnolen00:02:24

yep, just works

dnolen00:02:26

@bhauman pushed

bhauman00:02:36

@dnolen cool!

dnolen00:02:10

no problem, thanks for trying it out and giving feedback

bhauman03:02:20

gee whiz I still can't get the browser-repl to work

bhauman03:02:38

clj -m cljs.main -o fun.js -re browser -c mytry.core -r

bhauman03:02:59

<html> <body> <script src="fun.js"></script> </body> </html>

bhauman03:02:15

in out/other.html

bhauman03:02:02

I open localhost:9000/other.html in browser and it doesn't connect. My code runs and there is an iframe in the dom which has loaded the index and the clojure.browser.repl.client.start("");

bhauman03:02:11

no connection

potetm04:02:02

Not sure if it’s the problem you’re seeing, but I think there’s race condition that causes it to miss the server once in a while.

dnolen04:02:39

@bhauman pretty sure you want to write the output to out

bhauman11:02:02

I finally got it, it was painful

bhauman11:02:52

The server does serve from the directory that you launch the process from

bhauman11:02:55

One of the things that threw me was the lack of a default for :output-to. I thought main.js was the default for that

bhauman11:02:22

the lack of connection was caused by a previous launched cljs.main browser repl that didn't connect in another terminal tab, i had forgotten about it and it of course stopped me from getting anywhere in another terminal

bhauman11:02:28

now that its running, some observations:

bhauman11:02:44

any bad option --o with be tried as a script, a file existence check with a message would be fantastic here, "the file --o doesn't exist"

bhauman11:02:05

the -w blocks the -r option from launching a server and repl

bhauman11:02:54

-w could happen on a thread with then could either launch the repl or join the watch thread

bhauman11:02:14

or just launch the watcher on a thread if the repl is asked for

bhauman12:02:02

clj -m cljs.main -w src -o fun.js -re browser -c mytry.core -r

bhauman12:02:44

something else that happened right away is that the watcher died while loading a clj file (mytry/core.clj) that referenced an undefined var

bhauman12:02:15

that would be another good place for a try catch

bhauman12:02:16

other than those things cljs.main is looking great!

mfikes14:02:14

It is nice to see that Ambly works fine.

$ clj -m cljs.main -re ambly -e '(+ 1 2)' -r

[1] Ambly Demo on iPhone (mikes-imac-2)

[R] Refresh

Choice: 1

Connecting to Ambly Demo on iPhone (mikes-imac-2) ...

3
To quit, type: :cljs/quit
cljs.user=> (map inc [1 2 3])
(2 3 4)
cljs.user=> :cljs/quit
The only change needed was to ensure that cljs.repl.ambly/repl-env is defd to be ambly.core/repl-env in order to follow the naming pattern.

richiardiandrea18:02:48

I am puzzled, is this a bug?

self-host.test=> (def m {foo.with_underscore 1})
#'self-host.test/m
self-host.test=> (get m foo.with_underscore)
self-host.test=> 1
self-host.test=> (get m 'foo.with_underscore)
self-host.test=> nil

richiardiandrea18:02:39

note the abscence of ' in the m definition

bhauman18:02:55

@richiardiandrea one is the value of the symbol the other is the symbol itself

richiardiandrea18:02:34

I expected a "cannot find foo.with_underscore" warning or something on line 1

richiardiandrea18:02:39

Attached a new patch to https://dev.clojure.org/jira/browse/CLJS-2492, now the append-source-map function correctly munges the key name to :source-maps

mfikes18:02:06

@richiardiandrea Can't repro this way:

$ java -jar cljs.jar -re node
To quit, type: :cljs/quit
cljs.user=> (require 'cljs.js)
nil
cljs.user=> (cljs.js/eval-str (cljs.js/empty-state)
"(def m {foo.with_underscore 1})" nil {:eval cljs.js/js-eval :context :expr} prn)
{:error #error {:message "ERROR", :data {:tag :cljs/analysis-error}, :cause #object[ReferenceError ReferenceError: foo is not defined]}}

richiardiandrea18:02:38

$ clj -J-Dclojure.server.repl='{:port 5044 :accept clojure.core.server/repl}' -C:test -m cljs.main -re node -r
To quit, type: :cljs/quit
cljs.user=> (def m {'foo.with_underscore 1})
#'cljs.user/m

richiardiandrea18:02:14

(trying alternatives)

richiardiandrea18:02:24

uhm at some point i was getting the error as well

richiardiandrea18:02:31

now I cannot repro the error

richiardiandrea19:02:14

so @mfikes the behavior above happens only when I do clj -C:test -m cljs.main -r in the current clojurescript folder on master

richiardiandrea19:02:04

maybe I have some garbage, in any case I will dig more, I am more interested in your opinion on CLJS-2492, which solves for me the stacktrace mapping issue

mfikes19:02:35

Damn. Add a second failure that only occurs when using Java 9: https://dev.clojure.org/jira/browse/CLJS-2530 (First was https://dev.clojure.org/jira/browse/CLJS-2400)

richiardiandrea19:02:23

woah that's weird

mfikes19:02:36

Yeah, AFAICT, cljs.js.empty_state.cljs$core$IFn$_invoke$arity$0 contains JavaScript that Nashorn under Java 9 can't execute.

dnolen20:02:47

@mfikes huh, probably need to report a JDK bug

mfikes20:02:10

Yeah, the trick is isolating and making a minimal repro :slightly_smiling_face:

dnolen20:02:11

@mfikes that’s amazing about Ambly!

mfikes20:02:28

Yeah, I was surprised it all still works, given how different Ambly is about starting up!

mfikes20:02:31

Watching the Jim Lasky Project Detroit talk now. Looks like good stuff.

dnolen20:02:43

oh man so excited about Project Detroit

dnolen20:02:52

having embedded V8 in JDK would be huge

dnolen20:02:45

hi performance JS engine in the JDK would mean we could really be standalone - Node support would just be a great target not otherwise essential

dnolen20:02:31

@bhauman added default :output-to will address watch issues later

dnolen20:02:53

@mfikes re: Ambly that’s just great, it shows how generic the REPL stuff really is

mfikes20:02:41

Yeah, if I had only initially chosen cljs.repl.ambly as the package name, I would have needed to do nothing. Hah.

mfikes20:02:39

But, yeah, I really wanted to run Ambly with the latest stuff as another proof point

dnolen20:02:07

added a slide :wink:

mfikes20:02:27

Hah. Your talk is pretty damn soon now.