Fork me on GitHub
#clojurescript
<
2018-05-01
>
sova-soars-the-sora05:05:45

✌️:skin-tone-6: Hi Everyone, I made this with ClojureScript and Clojure, check it out! https://news.ycombinator.com/item?id=16964170 https://nonforum.com/

👍 4
delaguardo10:05:54

Looks like you are using :optimizations :none for clojurescript build. Please consider to switch to :optimizations :advanced) With that option enabled all your js resources will be in one minified file instead of multiple not optimized chunks

sova-soars-the-sora01:05:19

Hmmm... thanks for the suggestion. Out of curiosity, how were you able to tell? Just general latency?

delaguardo06:05:31

The delay gave me the first clue and I also looked at network tab in Chrome Dev Tools

sova-soars-the-sora10:05:27

Cool. I have changed it, and subsequent reloads are very fast. Thanks for the help. 😃

Casey07:05:20

So println can print cljs structures, but not javascript objects.. and the opposite goes for console.log

Casey07:05:37

is there a function that will pretty print both?

robert-stuttaford07:05:44

@ramblurr install cljs-devtools and use console.log

javi12:05:42

Hi everyone, does anyone know of any resources that explain how self-hosted cljs handles macros using, importing, defining...? thanks!

mfikes12:05:18

@fj.abanses The nice summary is that there is intended to really be no difference. The primary inherent difference is that macros have to be compilable as ClojureScript.

javi12:05:27

thanks @mfikes. ( and thanks for helping around so much) I am Trying to get a clear mental image of the 3 ( clj,cls, bootstrapped) and their differences. So when compiling regular cljs I have access to cljs.env/*compiler* dynamic var where i can see the options passed to the compiler... so ... can i access the corresponding var in the bootstrapped environment? or am i getting this wrong? I am writing a browser repl for UI composition and, taking a queue form devcards and this macro https://github.com/bhauman/devcards/blob/ae6d1a459b91cfbccb4594c0e6970b2de289a4b3/src/devcards/core.clj#L133 , I am exploring making test writing more visual and immediate,and still keep tests compatible with cljs.test test suites/runners.

mfikes12:05:57

Yes, you can access cljs.env/*compiler* in self-hosted ClojureScript. In fact, you can access it at runtime.

javi13:05:06

you are right, (.log js/console cljs.env/*compiler*) in my browser repl gets me the atom, thanks

andrea.crotti12:05:19

stupid question maybe but is there an equivalent of (is (thrown? java.lang.AssertionError).. for Clojurescript?

andrea.crotti12:05:31

to check if some assertions are raised in tests?

andrea.crotti13:05:10

assertions seems to be raised as #object[Error Error: Assert failed: false]

andrea.crotti13:05:28

not quite clear to me what I can match on from that error

jco14:05:43

Does lein cljsbuild once affect CSS in any way? I have a weird problem where I get a misplaced loading symbol when viewing my app in a browser, after building the app with lein uberjar (I've added cljs-hooks). If I run lein cljsbuild once min, the styling issue goes away. Can anyone give some tips ?

jco14:05:19

It seems lein-asset-minifier breaks my CSS in some way...

dpsutton15:05:29

i was checking the source of cljs.core/number? and it seems to return (cljs.core/number? x). how does this work?

dpsutton15:05:07

was hoping there was a protocol i could use. thanks so much. i really appreciate your writing to make things more approachable

gnl16:05:10

Is it possible to define Closure type annotations for clojure functions (from core, third-party libraries or my own namespaces) in externs files? For example:

/**
 * @externs
 */

var cljs = {};
cljs.core = {};

/**
 * @param {number} value
 * @return {number}
 */
cljs.core.inc = function (value) {};
This doesn't work, so I'm trying to figure out whether it's generally not possible or I'm just missing something.

emccue16:05:42

look at how the abandoned mori does it

gnl16:05:41

Thanks, but at a first glance it doesn't seem to be doing it at all - what am I missing?

gnl16:05:00

(first glance at the code that is)

emccue16:05:12

it exports core functions so they can be used from js

gnl16:05:38

so it wraps and annotates the wrapping function?

emccue16:05:38

I dont think it does it through externs

gnl16:05:44

Ah, okay.

emccue16:05:58

but I think that is your real ask

emccue16:05:19

(it is annoying, I get that)

gnl16:05:36

Yeah, not a great solution, but /a/ solution 🙂

gnl16:05:06

Do you know for a fact that there's no way to do it with externs?

emccue16:05:32

no I do not

gnl16:05:10

Okay, I'll keep looking, but at least this is something, thank you.

pre20:05:55

Are Javascript modules supported in 1.10.238? A hello-world example from the docs works for 1.9.x but throws errors for 1.10.238. https://clojurescript.org/guides/javascript-modules

node main.js

return module$home$neo$git$cljs$hello_modules$src$js$hello.sayHello();
                                                           ^

TypeError: module$home$neo$git$cljs$hello_modules$src$js$hello.sayHello is not a function
    at Function.hello_modules.core._main.cljs$core$IFn$_invoke$arity$variadic (/home/neo/git/cljs/hello-modules/out/hello_modules/core.js:28:60)
    at hello_modules$core$_main (/home/neo/git/cljs/hello-modules/out/hello_modules/core.js:24:33)
    at Object.cljs$core$apply_to [as apply_to] (/home/neo/git/cljs/hello-modules/out/cljs/core.js:12944:81)
    at Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (/home/neo/git/cljs/hello-modules/out/cljs/core.js:13388:18)
    at cljs$core$apply (/home/neo/git/cljs/hello-modules/out/cljs/core.js:13346:24)
    at Object.<anonymous> (/home/neo/git/cljs/hello-modules/out/AEF573C.js:10:17)
    at Module._compile (module.js:662:30)
    at Object.Module._extensions..js (module.js:673:10)
    at Module.load (module.js:575:32)
    at tryModuleLoad (module.js:515:12)

emccue22:05:46

see #shadow-cljs

emccue22:05:10

I think they are supported, but It is a constant headache for me

emccue22:05:37

shadow has the best out of the box experience for this imo