Fork me on GitHub
#clojurescript
<
2019-05-15
>
mfikes00:05:23

@grounded_sage Perhaps you are referring to how Klipse can be hooked up with a simple tag or two: https://github.com/viebel/klipse#integration

mfikes00:05:55

Oh, I see. You know your own answer. Doh!

mfikes00:05:20

How metacircular

Risetto07:05:32

I'm looking for an equivalent to the angular "ng-template" element, in Reagent. Is there such a thing? Basically what I want to do is to output two "top level" hiccup elements, without wrapping them in another element

Risetto07:05:15

(do
  [:div "first"]
  [:div "second"])

Risetto07:05:22

But that's not a thing 🙂

thheller07:05:04

@olle142 thats called a fragment in React so I think its [:<> [:div ...] [:div ...]] in reagent

Risetto07:05:36

@thheller Exactly what I'm looking for, thank you so much!

romdoq08:05:15

Hmm, in Clojure (range nil 6) is a NullPointerException, but in ClojureScript it produces (nil 1 2 3 4 5). That seems wrong to me. Anyone aware if that's known/accepted behaviour?

Vesa Norilo08:05:44

well, cljs also thinks (inc nil) is 1

Vesa Norilo08:05:13

much like js when you say null + 1

Vesa Norilo08:05:35

I have grown used to counting things with (swap! count-map-atom update thing-kind inc)

jaihindhreddy09:05:05

You need to use fnil to make the above code portable.

jaihindhreddy09:05:33

Because Clojure(Script) don't wrap host primitives, such differences cannot be eliminated.

Roman Liutikov09:05:27

Interestingly cljs warns about numeric types in math operations, perhaps it would make sense to have same warning for inc/dec

mfikes11:05:09

The problem actually that arithmetic warnings in general are missing for nil

Risetto11:05:07

I want to make my emacs a good place to work with cljs so bad, but from my experience so far a switch to Cursive seems like the better move. How do you guys feel about clojurescript support in cider?

Risetto11:05:58

Not support, but actually maintaining and configuring a working environment seems tricky. And having to do that on a project to project basis might not be viable

lilactown15:05:22

for me, I’ve whittled my workflow down to a few basic things. For tools, I use shadow-cljs and Spacemacs with clojure-layer. When I want to start a new project, I typically copy a couple files from another project: - shadow-cljs.edn - public dir with index.html, app.css - .gitignore Then to do work, I open up a CLJS file in the project and: - M-x cider-connect-clojurescript - Choose shadow for the REPL type - Choose my build name (e.g. app) - Press Y to open up a browser window with everything loaded And I’m off!

lilactown15:05:02

AFAICT the only thing specific to Emacs/CIDER is how I connect to the REPL. All of the other busy work w.r.t. project configuration I would have to do anyway

dkrieger16:05:20

I haven't had issues using figwheel-main and spacemacs. The biggest issue I've noticed in spacemacs using ClojureScript compared to Clojure is that I can't connect a REPL when not in a project, specifically when I'm in cljs babel blocks. I have yet to use shadow-cljs in general

mfikes11:05:31

Ticket for nil being passed to arithmetic functions: https://dev.clojure.org/jira/browse/CLJS-3086

👍 4
Roman Liutikov12:05:39

Do you mind if I take a look at 3085? Always wanted to dig into type inferences in the compiler

mfikes19:05:47

That would be awesome if you wanted to dig into it 🙂

mfikes19:05:32

@U0FR82FU1 Assigned it to you. Feel free to ask if you get stuck.

mfikes20:05:56

@U0FR82FU1 I've added some implementation guidance to the ticket. It looks like it could be a fairly straightfoward one.

carkh18:05:14

How do I ensure a bit of code throws an error in cljs.test ?

mfikes18:05:37

I usually put js/Error in the place where that doc refers to ArithmeticException

carkh18:05:46

@mfikes i've seen that but Use of undeclared Var cljs.test/thrown?

carkh18:05:31

all my testing works but that part =(

mfikes18:05:37

(require '[clojure.test :refer [is]])
(is (thrown? js/Error (ffirst 1)))
Does a simple test like that in the REPL produce a truthy value for you?

carkh18:05:03

oh clojure.test instead of cljs.test ?

mfikes18:05:25

(require '[cljs.test :refer [is]]) should work just as well in the above

carkh18:05:27

mhh thrown? is actually some kind of a macrolet ?

mfikes18:05:59

The way it works is that is is a macro and it understands the thrown? symbol. (This is not a very common pattern, FWIW, but it is the way it works.)

mfikes18:05:19

If you macroexpand the is form above you will get more insight.

carkh18:05:40

thanks that's the pointer i needed !

mfikes18:05:52

If, on the other hand yo uare using thrown? outside of is, that would do it.

mfikes18:05:31

Or, dunno. Anyway. 🙂

carkh18:05:33

i was trying to namespace thrown? and couldn't find it anywhere

carkh18:05:42

working now !

carkh18:05:48

thanks again