This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-15
Channels
- # aws-lambda (6)
- # beginners (8)
- # cider (12)
- # cljs-dev (12)
- # cljsrn (9)
- # clojars (2)
- # clojure (161)
- # clojure-berlin (9)
- # clojure-italy (10)
- # clojure-russia (18)
- # clojure-spec (20)
- # clojure-uk (18)
- # clojurescript (37)
- # cursive (13)
- # data-science (1)
- # datomic (23)
- # flambo (2)
- # hoplon (22)
- # immutant (11)
- # jobs (1)
- # klipse (11)
- # leiningen (5)
- # liberator (7)
- # luminus (5)
- # lumo (3)
- # off-topic (28)
- # om (8)
- # onyx (15)
- # parinfer (111)
- # pedestal (21)
- # re-frame (6)
- # reagent (38)
- # rum (4)
- # spacemacs (2)
- # specter (34)
- # unrepl (122)
- # untangled (3)
- # vim (1)
- # yada (8)
hallo @pesterhazy !
@richiardiandrea hmm find-ns
happens to trigger an interesting shadowing bug, opened https://dev.clojure.org/jira/browse/CLJS-2088
cgrand: just woken up saw the fix and patch thanks! I patched inf-clojure with lumo.core
and was wondering why $macros
is now in there and not core
only anymore
cgrand: lol let me rephrase
Why did you switch to detecting core$macros
instead of core
because in self-hosted cljs, (find-ns 'lumo.repl)
cripples access to this ns macros (open lumo, enter this find-ns
and after that try to use doc
)
Oh gotcha temporary fix before your patch is officially in
Identifying a repl:
(cond
(find-ns ') :clj
(find-ns ') :cljr
(find-ns 'lumo.repl$macros) :lumo
(find-ns 'planck.repl$macros) :planck
(find-ns 'cljs.core$macros) :cljs-js
(find-ns 'cljs.core) :cljs-jvm
:else :unknown)
why not once per connection?
rlwrap nc localhost 8201
shadow-cljs - REPL - see (help), :repl/quit to exit
[13:0]~shadow.user=> (shadow/node-repl)
[13:1]~cljs.user=> :repl/quit
:repl/quit
[13:0]~shadow.user=>
@pesterhazy starts out as CLJ, then becomes CLJS, then CLJ again
Some ideas start to click together. The current cljs repl infrastructure is not ok but it can be remixed (that is: reuse environments and so on but recreate an upgradable infrastructure to replace https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/repl.cljc)
I dunno, ask @pesterhazy or @richiardiandrea
@thheller I'd test with netcat first
once you have a working protocol, you can try unravel
this is where the blob is concatenated at the moment: https://github.com/pesterhazy/unravel/blob/b687edb188aaab58b9ac0ce7a143172dc3e256a6/src/unravel/loop.cljs#L115
it's not updated yet to use the "official" unrepl blob
of course the blob would have to be completely replaced
so if you eval (js/alert "foo")
the client actually just evals alert("foo")
nothing else
@cgrand, I did a presentation on unrepl/unravel here in Berlin yesterday. Here are the slides: http://pesterhazy.karmafish.net/unravel-your-repl.pdf
pretty well. I had a few people express interest in contributing after the talk, which is awesome
cgrand: thanks! I really like the whole idea. I told @pesterhazy yesterday that I went through the documentation two nights ago, to prepare for the talk, and I think I can contribute a very small PR with some minor fixes to the README (commas, and a couple typos) and then maybe I can help with documenting more stuff (missing tags like :started-eval
, and so on)
[15:1]~cljs.user=> [1 2 3]
(] 3 2 1 [)
[15:1]~cljs.user=> (set! shadow.cljs.devtools.client.env/repl-print-fn #(reverse (pr-str %))
)
(] " }
; ) ) _ P R A H S _ 5 2 6 5 4 _ _ 1 p , l l u n ( l l a c . r t s _ r p . e r o c . s j l c , l l u n ( l l a c . e s r e v e r . e r o c . s j l c n r u t e r
{ ) _ P R A H S _ 5 2 6 5 4 _ _ 1 p ( n o i t c n u f " n o i t c n u F [ t c e j b o #)
[15:1]~cljs.user=> [1 2 3]
(] 3 2 1 [)
@cgrand, yup, I've learned a new word 🙂
[15:1]~cljs.user=> (set! shadow.cljs.devtools.client.env/repl-print-fn #(clojure.string/upper-case (pr-str %)))
#OBJECT[FUNCTION "FUNCTION (P1__45626_SHARP_){
RETURN CLOJURE.STRING.UPPER_CASE.CALL(NULL,CLJS.CORE.PR_STR.CALL(NULL,P1__45626_SHARP_));
}"]
[15:1]~cljs.user=> [:hello :world]
[:HELLO :WORLD]
yes there is, @plexus made one https://github.com/plexus/unrepl/blob/lumo_support/src/unrepl/print.cljc
[15:1]~cljs.user=> (load-file "/Users/zilence/code/shadow-cljs/src/dev/unrepl/print.cljc")
[:result {:type :repl/error, :message "cond-splice not in list", :data {:type :reader-exception, :line 15, :column 5, :file "unrepl/print.cljc"}, :causes []}]
print.cljc is completely untested. I got as far as making sure the forms evaluated without errors on Lumo. That's it. It almost certainly is incomplete, it's just a first pass addressing the most obvious differences.
[18:0]~shadow.user=> (shadow/dev :browser)
[18:1]~cljs.user=> (require 'unrepl.print)
[18:1]~cljs.user=> (set! shadow.cljs.devtools.client.env/repl-print-fn unrepl.print/edn-str)
nil
[18:1]~cljs.user=> {:foo "bar"}
{:foo "bar"}
TypeError: Cannot read property 'cljs$core$IFn$_invoke$arity$1' of undefined
at cljs.core.MultiFn.cljs$core$IFn$_invoke$arity$1 (cljs.core.cljs:10295)
at Function.unrepl.print.ednize.cljs$core$IFn$_invoke$arity$3 (eval at shadow$cljs$devtools$client$browser$do_js_load (shadow.cljs.devtools.client.browser.cljs:48), <anonymous>:457:119)
at Function.unrepl.print.ednize.cljs$core$IFn$_invoke$arity$2 (eval at shadow$cljs$devtools$client$browser$do_js_load (shadow.cljs.devtools.client.browser.cljs:48), <anonymous>:425:28)
at Object.unrepl$print$print_on [as print_on] (eval at shadow$cljs$devtools$client$browser$do_js_load (shadow.cljs.devtools.client.browser.cljs:48), <anonymous>:610:33)
I haven’t had time to test it, I was doing some preliminary work on the upgradable cljs repl
TypeError: Cannot read property 'cljs$core$IFn$_invoke$arity$1' of undefined
at cljs.core.MultiFn.cljs$core$IFn$_invoke$arity$1 (cljs.core.cljs:10295)
at Function.unrepl.print.ednize.cljs$core$IFn$_invoke$arity$3 (eval at shadow$cljs$devtools$client$browser$do_js_load (shadow.cljs.devtools.client.browser.cljs:48), <anonymous>:457:119)
at Function.unrepl.print.ednize.cljs$core$IFn$_invoke$arity$2 (eval at shadow$cljs$devtools$client$browser$do_js_load (shadow.cljs.devtools.client.browser.cljs:48), <anonymous>:425:28)
at unrepl$print$print_on (eval at shadow$cljs$devtools$client$browser$do_js_load (shadow.cljs.devtools.client.browser.cljs:48), <anonymous>:610:33)
at Function.unrepl.print.print_vs.cljs$core$IFn$_invoke$arity$5 (eval at shadow$cljs$devtools$client$browser$do_js_load (shadow.cljs.devtools.client.browser.cljs:48), <anonymous>:571:113)
at Function.unrepl.print.print_vs.cljs$core$IFn$_invoke$arity$3 (eval at shadow$cljs$devtools$client$browser$do_js_load (shadow.cljs.devtools.client.browser.cljs:48), <anonymous>:516:30)
at Object.unrepl$print$print_on [as print_on] (eval at shadow$cljs$devtools$client$browser$do_js_load (shadow.cljs.devtools.client.browser.cljs:48), <anonymous>:653:23)
at unrepl$print$edn_str (eval at shadow$cljs$devtools$client$browser$do_js_load (shadow.cljs.devtools.client.browser.cljs:48), <anonymous>:698:18)
Error: No method in multimethod 'unrepl.print/default-ednize-fn' for dispatch value: function Function() { [native code] }
[20:1]~cljs.user=> (range 0 1000)
(try try try try try try try try try try #unrepl/... nil)
re: protocol, really I don’t see why anymore, maybe to have the opportunity to prefer impls in case of conflicts?
on line 234 blame-seq
which is a macro is called like a function (because cljs) and then its head (`try`) is used for v
#?(:clj
(defmacro ^:private blame-seq [& body]
`(try (seq ~@body)
(catch Throwable t#
(list (tagged-literal 'unrepl/lazy-error t#))))))
cgrand: just woken up saw the fix and patch thanks! I patched inf-clojure with lumo.core
and was wondering why $macros
is now in there and not core
only anymore