Fork me on GitHub
#clojurescript
<
2016-05-07
>
risto00:05:24

is there currently a way to provide compile-time type checking for clojurescript?

risto00:05:22

it looks like [this](https://github.com/clojure/clojurescript/wiki/Compile-Time-Type-Checking) is still in progress, and [core.typed](https://github.com/clojure/core.typed) says that the type checker doesn't work anymore

xcthulhu00:05:55

How do I do a zero-fill right shift (`>>>`) in clojurescript?

kauko05:05:43

@cfleming: The presentation is in three weeks. I actually saw your comment in github, saying you should have something "soon" simple_smile

kauko10:05:04

Anyone have experience with devcards? Is the best pattern to have a separate devcards/ folder, and in it define the cards for the components I want?

bhauman13:05:01

@sbmitchell: seems ripe for a macro but this works

(-> jsobj
    (gobj/get "hey")    
    (gobj/get "there")    
    (gobj/get "now") )
Where gobj is goog.object

madvas14:05:28

Is anybody aware of some good print debugging library for Clojurescript, sth like https://github.com/AlexBaranosky/print-foo ?

xcthulhu14:05:46

@sbmitchell: Here's a function that does what you want

(defn aget-in
  [obj [p & rst :as path]]
  (if (or (nil? obj) (empty? path))
      obj
      (recur (aget obj p) rst)))

ashraf215:05:23

is there any detail example on - defstyles macro for garden

ashraf215:05:38

I am having hard time using it

ashraf215:05:12

here is a minimal example

ashraf215:05:45

(defstyles screen (let [body (rule :body)] (body {:font-family "Helvetica Neue" :font-size "20px" :line-height 1.5 } )))

ashraf215:05:50

for example I want to add a css class

xcthulhu16:05:18

I never use the defstyles macro.

xcthulhu16:05:17

Here's a style that does what you want: (def style [[:body {:font-family "Helvetica Neue", ...}]])

Tim16:05:05

don’t you want that to be a map, not a vector?

xcthulhu16:05:13

Vector works fine. I suppose you could use a map, it doesn't matter

xcthulhu16:05:42

Beware of garden, btw. I use it but it's got some sharp edges.

xcthulhu16:05:03

For instance, it doesn't have any validation on its output, and it's easy to coax it into outputting garbarge

Tim18:05:33

isn’t garden just like a basic css processor with clojure syntax?

Tim18:05:14

or I guess you can compose styles which is a bit more than what sass does I guess

madvas18:05:08

Guys, is there a way to automatically :require-macros of some clojure file for each Clojurescript file in a project?

jrychter19:05:22

What is the recommended way of requiring core.async in a .cljc file? I'm trying out various combinations of #?(:cljs (:require-macros [cljs.core.async.macros :refer [go-loop]]), (:require #?(:clj [cljs.core.async :as async :refer [go-loop]] :cljs [cljs.core.async :as async])) and similar, and failing so far.

jrychter19:05:47

Ideally I'd like to have all of async :as async, but I think that can't be done in ClojureScript, so let's :refer go and go-loop.

mfikes19:05:19

@madvas: No, not generally. If there is an associated runtime file, then implicit macro loading may help. (See https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure#namespaces)

jrychter19:05:48

In general I have a problem with cljc, because ClojureScript uses :require-macros, while in Clojure that doesn't exist. This leads to lots of ugly ns forms with lots of conditionals…

xcthulhu19:05:31

@jrychter: Try [cljs.core.async :as async :include-macros true]

jrychter19:05:33

Actually, that was a dumb question — I just noticed that the package names are different: cljs.core.async and clojure.core.async. So I have to conditionalize the whole thing anyway.

xcthulhu19:05:52

Try #?(:clj [clojure.core.async :as async] :cljs [cljs.core.async :as async :include-macros true]) then

xcthulhu19:05:13

In your (:require ...)

madvas19:05:38

@mfikes: Thanks. Is there a way to :refer all macros at once from .cljs file?

jrychter19:05:47

Well, I ended up with something similar. But in general :require-macros gets in the way when migrating to cljc. I think it might make sense to make it work like :refer when compiling as :clj. It would certainly simplify my ns forms quite a bit.

jrychter19:05:48

On a related note, this whole cljc thing — it's mind-boggingly awesome. I built a search engine that works in ClojureScript and for larger databases can switch to server-side query processing — same bit of code. And now I'm pre-rendering most of my UI (React-based app) on the server, without even touching node.js or Nashorn. It feels ridiculously powerful.

mfikes19:05:16

@jrychter: you'd probably like the simplification http://dev.clojure.org/jira/browse/CLJS-1507 would afford

jrychter19:05:14

@mfikes: Yes, that looks like it would solve a lot of the problems I'm encountering. I think it would still be helpful to have :require-macros behave like :refer in Clojure. If I understand the ticket correctly (it's late), I would still need to use :require-macros for macros defined in the "first-order" required namespace. E.g. the ticket would help with the macros that the required namespace itself uses, but not ones that it itself defines.

mfikes19:05:00

@jrychter: :refer-macros is another nice way to avoid having a separate explicit :require-macros spec

jrychter19:05:31

@mfikes: well, true. And I appreciate its existence. But not knowing the super-complex internal workings of ClojureScript and Clojure lets me naively hope that we could unify macro handling one day and use a single ns form for both ClojureScript and Clojure.

mfikes19:05:31

right. CLJS-1507 is the closest to realizing that dream (for many common lib consumption use cases) that I'm aware of

spiralganglion20:05:26

Is there a trick to getting source maps to work in browsers other than Chrome?

sbmitchell22:05:45

@xcthulhu Thanks for that fn on the nested prop retrieval in a js obj

sbmitchell22:05:19

I ended up changing it to just a reduce

risto23:05:01

@ivanreese: Firefox has sourcemaps support also, it should be the same. Vivaldi is using the same dev tools as Chrome. Not sure about Safari or IE since I'm on a Linux box

spiralganglion23:05:14

I tested with FF and Safari — log statements in the console point back to JS source. In Chrome, log statements in the console point back to CLJS source. I was just curious if this is a known issue, or if it's possible that I might have something misconfigured. I've used source maps in Safari before on purely JS projects, so I know it's possible. Not a big deal, I can just use Chrome (though it's absolutely my least favourite browser ducks )