Fork me on GitHub
#clojurescript
<
2016-09-25
>
adamkowalski03:09:42

whats a good way to check if something is a core async chan

adamkowalski03:09:51

if I want to use clojure spec for example to make sure one of my args is a chan

adamkowalski03:09:21

im using this as my pred

(defn chan? [c]
  (= cljs.core.async.impl.channels/ManyToManyChannel
     (type c)))

moxaj08:09:35

@hlolli the problem is, this is library code. So I'd like to do it programmatically. If it were clojure, I could just require two different namespaces depending on cljs.core/*target*, but cljs does not have a require.

nowprovision12:09:42

am I dreaming or was there a recent change where refer-macros was no longer required?

darwin12:09:59

I think you can use :refer for macros when you know that macro file was already analysed. For example this works when consuming libs via their cljs namespace which is linked to corresponding clj macro file inside. E.g. in lib.cljs you have (:require-macros [my.lib]) which points to lib.clj

pat12:09:40

@adamkowalski #(implements? cljs.core.async.impl.protocols/Channel %)

pat12:09:12

@adamkowalski for the type you use instance? but protocol is better

nowprovision13:09:44

using lein figwheel, I've created dev/user.cljs and add 'dev' to source path, doesn't seem to be getting picked up, i.e. any vars declared undeclared in figwheel repl, google keeps bouncing me to user.clj articles

nowprovision13:09:17

^ ignore.. clean-builds.. working

nowprovision14:09:43

actually clean-builds got me compiler errors in user.cljs which when fixed, reload no errors, but still not seeing any vars..

darwin14:09:50

I think that user namespace stuff applies to clojure land only

darwin14:09:59

they speak about user.clj not user.cljs

darwin14:09:58

never used user.clj myself, so just my 2 cents

jrheard15:09:53

anyone know if there’s a good way to colorize cljs.test output?

pat18:09:12

@jrheard assuming you are using a unix terminal you will have to create a custom report function that uses ansi escape codes

pat18:09:08

Figwheel uses ansi colors, id look there

peeja18:09:50

As I understand it, the attr map on a Clojure function will be evaluated, but the attr map on a ClojureScript function is always quoted. So, given (defn foo {:bar (+ 1 1)} [] nil), (:bar (meta #'foo)) is 2 in Clojure and (+ 1 1) in ClojureScript. Is that correct?

peeja18:09:16

I assume that's because the code would have to run at compile time

peeja18:09:59

Is there a way to give a ClojureScript var metadata which depends on the metadata of another var (without writing a custom macro to replace defn)?

jasonjckn19:09:50

what's the best IDE/editor for people on my team that are new to clojurescript? I have them on Intellij right now, is light table a viable option?

jasonjckn19:09:08

(the more experienced among us use emacs)

jasonjckn19:09:28

our project has both clojurescript and clojure

jrheard19:09:11

cursive is a strong option imo

jasonjckn19:09:44

cool, so far it's been working out decently, they struggle with parens still though

jasonjckn19:09:57

i see cursive has parinfer mode, but it's a bit buggy

jasonjckn19:09:10

and paredit mode has a lot of key bindings to memorize

jasonjckn19:09:05

i think parinfer is probably ideal for them if it worked all the time, I filed a bug report already with the project but it hasn't been addressed in 3 months

hueyp19:09:57

I pretty much only use alt-up / alt-down in intellij with paredit

jasonjckn19:09:16

i don't think they use that, thanks i'll let them know

hueyp19:09:31

I always struggled w/ clojure due to editors (I never learned vim / emacs — just used stuff like textmate / sublime / etc) but cursive has gotten me over the hump to feeling productive — only complaint is all the inellij baggage and some mac platform key shortcuts don’t work out of the box

jasonjckn19:09:18

do you use parinfer, paredit or structural off?

sbauer19:09:37

While on the topic of editors, are there any driving reasons behind using cursive over light table? Or is it simply preference?

manenko19:09:01

I use Emacs, but what I really don't like in LT is its poor autocomplete and refactoring support

sbauer19:09:27

I take it emacs has a better autocomplete? I never got into emacs myself

sbauer19:09:22

Thanks for the link! I'm looking for ways to improve the user experience with light table so any other feedback is helpful!

hueyp19:09:44

I use paredit in cursive … I haven’t tried the other modes … basically I hit alt-up and alt-down and tab a lot 😜

hueyp19:09:13

I imagine my use is suboptimal — but I’ve never been really big into tooling / editors — like I don’t customize stuff. cursive is the first time I’ve felt comfortable writing clojure (even if I’m bad at it)

manenko20:09:58

@sbauer > I'm looking for ways to improve the user experience with light table so any other feedback is helpful! Paredit mode isn't strict enough. Or maybe I just didn't setup it right 🙂 For example, I can put my cursor | between ( and reagent/cursor:

(|reagent/cursor app-state [:account])
And hit backspace key. Result will be:
|reagent/cursor app-state [:account])
In Emacs Paredit mode I cannot do that. It protects me from having unbalanced opening and closing parenthesis/brackets/braces.

sbauer20:09:47

Ah, good point about the protection. I'll open an issue to capture this tonight

manenko20:09:08

thank you 🙂

jcb20:09:25

is there a standard way of removing an event listener set with a :listener in reagent?

jcb20:09:51

or to change it's handler?

sherbondy21:09:54

Has anybody mucked around with hooking up https://github.com/google/closure-compiler-js to the cljs compiler? I’m guessing this is pretty non-trivial and would require an overhaul of, e.g. https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj among other namespaces? But might be a game changer to be able to have, e.g. bootstrapped cljs emit optimized code?