Fork me on GitHub
#clojurescript
<
2016-02-12
>
superstructor00:02:40

JavaScript emitted by the ClojureScript compiler causes warnings in SpiderMonkey like “test for equality (==) mistyped as assignment (=)?" due to code like if (c = cljs.core.seq(c)) in cljs.core.extend_object_BANG_ (for example). Is there any way to avoid that with compiler or Google Closure options ?

zentrope04:02:27

@maio: Yes.

dev-hartmann11:02:51

does anyone have a good resource for styling om component

meow11:02:31

You could check the #C06DT2YSY channel @dev-hartmann

jiyinyiyong14:02:15

This is my Reagent code, the layout, do you like it?

dnolen14:02:29

@superstructor: there should be a way to turn off such warnings in SpiderMonkey - that’s perfectly valid JavaScript

dnolen14:02:36

linting in JS engines is really obnoxious

larhat14:02:01

> way to turn off such warnings in SpiderMonkey we used to have our own error reporter hook for spidermonkey, where we ignored certain errors

echristopherson14:02:56

@jiyinyiyong: we don't need no stinkin' parentheses

jiyinyiyong15:02:18

@echristopherson: I fought against parentheses for long, here's a demo in Chrome http://repo.cirru.org/editor/

peeja15:02:38

If I wrap chunks of code in (when foo … ) and then set foo to false in :closure-defines, will advanced compilation remove that whole chunk of code?

peeja15:02:47

and if not, is there a way to get it to do something like that?

peeja15:02:13

I have some dev-only code that I'd love to not even end up in the production build, just to keep it smaller

echristopherson16:02:46

@jiyinyiyong: I'm not totally sure what it is. Your first pic looked like Clojure, but this looks like JS. Is it an indent-structured way of using various languages?

echristopherson16:02:23

or an editor that automagically translates parens and braces <-> indents

peeja16:02:26

@rauh: Is that saying that type-annotating the define as a boolean will allow Closure to remove the code when it's false?

rauh16:02:57

Yes. I'm not 100% sure you still need it nowadays but last I checked you need the type hint

peeja16:02:09

Awesome, thanks!

echristopherson16:02:44

too many clo*ure names

peeja16:02:42

Ah, you do need the type hint. It's because ClojureScript emits if(cljs.core.truth_(the_value)) { … } without the hint, and if(the_value) { … } with it.

jannis16:02:50

If I write a macro for ClojureScript and I want to refer to js/Object, how would I do that?

jannis16:02:40

In this particular case I would like to write a macro to generate an Om Next (defui SomeName Object (render [this] ...)) definition where the input would be SomeName and a list of function bodies to add after Object.

peeja16:02:51

@jannis: Your macro will return a form which will then be evaluated in the context where it's called, as if you had written that form out by hand in your CLJS. So, in this case, you'll want your macro to use the symbol 'Object.

peeja16:02:29

It doesn't have to refer to anything in the macro code, just be a symbol which will mean something in the ClojureScript code after it's expanded.

jannis16:02:18

Ok. I'll try that. So far it always seems to think I'm refering to java.lang.Object.

peeja16:02:05

Ah, that'll be a quoting problem

jannis16:02:22

Sounds like it

peeja16:02:50

You may be using `Object by accident?

peeja16:02:36

If you syntax-quote it in the macro, it'll resolve to whatever Object means in the macro (which will be java.lang.Object).

jannis16:02:46

Yes, I'm aware of that at least simple_smile

jannis16:02:11

I'll give it another shot and share a minimalistic snippet if I can't get it to work.

peeja16:02:50

Unfortunately, being aware of how quoting works and getting it to work right in any particular case do not appear to correlate as well as one would like. simple_smile

jannis16:02:53

I noticed Om Next's defui refers to &env. Where does that come from?

peeja16:02:14

That's a thing macros get for free that tells them about the context in which they're called

peeja16:02:24

It's mostly used to find local bindings

peeja16:02:35

(It's also rather poorly documented.)

peeja16:02:05

Oh, I take it back, it is just the locals

jannis16:02:45

If I do the same I get Unable to resolve symbol: env in this context

peeja16:02:08

Hmm. Can you post some code?

jannis16:02:24

Sure, just a sec

peeja17:02:12

(`defview*` wants to be taking a third argument, I think.)

peeja17:02:34

Oh, wait.

peeja17:02:55

The syntax of defview* looks funky all around.

jannis17:02:10

Oh, indeed.

jannis17:02:46

The notation for different arities is ([...] ...) ([...] ...), not ([...] ... [...] ...).

futuro19:02:32

Is it possible to defmulti in one ns and defmethod in a different ns?

peeja19:02:51

@futuro: It is!

peeja19:02:56

It's one of the neat things about them

futuro19:02:08

@peeja: sweet, glad to hear

futuro19:02:14

thank you simple_smile

futuro19:02:56

that is really neat, actually

alexmiller19:02:44

that's how it is a system open to future extension

alexmiller19:02:50

(same for protocols)

echristopherson20:02:02

is cljs always being developed with the idea of making it support everything from clj-jvm?

dnolen20:02:05

@echristopherson: everything excluding Java-isms and concurrency stuff yes

dnolen20:02:22

there are some things missing for implementation reasons but these are few and far between

echristopherson21:02:41

oh, concurrency... hmm

aria_21:02:36

Isn’t core.async available in the clojurescript though?

dnolen21:02:17

@aria_: Clojure has quite a few built in concurrency things not really covered by core.async

aria_21:02:38

Ah okay. I’m quite the beginner so I just wanted that clarified.

dnolen21:02:42

they assume real JVM multithreading

stuartsierra21:02:04

Specifically, clojurescript does not have Refs, Agents, Futures, or threads.

stuartsierra21:02:41

The CLJS version of core.async has no thread-blocking operations like <!! and >!!

echristopherson21:02:31

man, those look like FORTH

johanatan21:02:50

Can anyone point me to the state of the art for building ClojureScript for Node.js (presumably Boot rather than Lein at this point). I see several projects on GitHub claiming to be "examples" but I am really looking for a canonical one.

dnolen22:02:05

if anyone is interested in these head over to #C07UQ678E

echristopherson22:02:46

I see jira isn't responsive yet

spieden23:02:01

does anyone use lein and have a cache busting plugin they like?