Fork me on GitHub
#clojurescript
<
2019-07-24
>
borkdude08:07:22

$ plk
ClojureScript 1.10.520
cljs.user=> (defn foo [^js x])
#'cljs.user/foo
cljs.user=> ^js {:a 1}
             ^
WARNING: Use of undeclared Var cljs.user/js at line 1
{:a 1}
cljs.user=>
This seems a bit inconsistent: CLJS warns about the second, but not the first?

thheller08:07:33

neither should warn

borkdude08:07:54

@thheller why not? in CLJ:

$ clj
Clojure 1.10.0
user=> ^js {:a 1}
Syntax error compiling at (REPL:0:0).
Unable to resolve symbol: js in this context

thheller08:07:05

in clj the :tag meta is actually resolved for compilation. in CLJS it is just a blank hint that is never resolved and always used as is

thheller08:07:15

(given the more dynamic nature of JS that is fine)

borkdude08:07:32

so it's just a random symbol?

thheller08:07:44

not random but just a symbol yes

thheller08:07:18

they do guide the compiler and affect some of the generated code

borkdude08:07:47

$ plk
ClojureScript 1.10.520
cljs.user=> (let [js 'foo] ^js {:a 1})
{:a 1}
cljs.user=> (meta *1)
{:tag foo}

borkdude08:07:21

there seems to be a difference between ^ and using ^ in function arguments

borkdude08:07:08

so for clj-kondo I'll just turn warnings off in CLJS for type hinted function arguments / local bindings

thheller08:07:11

it is news to me that this evaluated at all since all references I found in the code don't

thheller08:07:16

ah yeah actually its a special case for all the collections that this is actually kept for the JS runtime and not just used by the compiler

borkdude08:07:27

what exactly is the bug?

thheller09:07:09

:tag missing from that dissoc call

thheller09:07:18

to me it seems like it should be in that list but it is quite pointless to tag CLJS collections since that overrides the actually correct tag

borkdude09:07:41

it was just an example, maybe not a good one

heyarne09:07:53

What's the recommended way to script something with clojurescript? I need to fetch some data, munge it and spit out a csv. Development in the REPL (preferrably via CIDER) and npm interop would be heaven

tianshu10:07:33

When I use reagent's

(defn foo []
   (fn [props]
     The props here will never change

tianshu10:07:49

Not matter how parent changing the state.

tianshu10:07:57

I think I know why, It seems I deal with how component render its children in a wrong way

tianshu11:07:01

Is this the correct way to deal with children in reagent?

(defn foo []
  (fn [props & children]
    (into [:div {...}
      children)))

chrisulloa17:07:15

Is this doable with Clojurescript? https://js13kgames.com/

chrisulloa17:07:38

Would be interested to know if anyone’s submitted to these contests before and what your experience was

dnolen17:07:03

@christian.gonzalez I'm not aware of anything - the key thing to make it into that competition would be to use ClojureScript at a low level

dnolen17:07:13

i.e. no persistent data structures

chrisulloa17:07:28

Right, that makes sense. Probably end up doing a lot of interop, avoiding deps

chrisulloa17:07:49

though at that point it would probably just make sense to do it in js

dnolen17:07:29

@christian.gonzalez yeah that's not a ton of advantage other than macros and Closure advanced compilation integration

dnolen17:07:51

http://swannodette.github.io/2013/06/10/porting-notchs-minecraft-demo-to-clojurescript best viewed in Chrome (though could be updated to be made fast everywhere these days), this is 4.1K

chrisulloa17:07:28

oh this is awesome thank you

mfikes17:07:51

And if you are curious, I found that David's code can be re-cast without mutation 🙂 https://blog.fikesfarm.com/posts/2014-07-14-nolens-notchs-minecraft-without-locals.html

🆒 4
👍 8
br18:07:18

Hi all, is there a good solid book or online resource for either: a) learning cljs for node dev or b) an honest appraisal of the tradeoffs of using cljs for node apps? Google search pushes lots of shallow references, not in-depth ones. (My context: refactoring GraphQL service—with dependencies on js-only libraries like Apollo —as it's starting to get too big and unwieldy already. Not already experienced with TS so learning curve whatever way I choose to go)

nenadalm05:07:30

Hi. I don't know of any books or some detailed explanations. There's possibly only one framework I know of (and use): https://macchiato-framework.github.io/ which can be used with reitit routing: https://github.com/metosin/reitit You can see a bit of info about Macchiatto on the author's blog: https://yogthos.net/archives.html There is also small demo app I created if you weren't sure how to put it together: https://github.com/nenadalm/spa-demo

dnolen18:07:34

there's not too much to know - it works reasonably well

dnolen18:07:51

which is probably why you can't find much specific information

br18:07:02

Hi David, ah, okay. I suppose I want a specifically cljs resources that are node-oriented, not react/fe-oriented

br18:07:18

There are lots of great resources for the latter

dnolen18:07:22

well React is a framework and there's some machinery between ClojureScript so you need that type of thing

dnolen18:07:32

Node.js is just a JavaScript runtime more or less

dnolen18:07:55

I think you can just ask questions here and you'll probably get the answers you need

br18:07:15

p.s. I enjoy your talks on code very much, always thought-provoking and compelling, thank you for all your efforts

dnolen18:07:30

your welcome!

dmaiocchi20:07:27

I was interested to build an interface webui like the Twitter one, where one could get events on top etc

dmaiocchi20:07:50

Anyone knows which Lib pattern should I look?

dmaiocchi20:07:39

I was thinking at reagent but I don't know if o' the webui design level one call such ui in particular term

kwladyka21:07:38

How do you do Server Side Rendering for your Single Page App for SEO? Do you have battle tested solution?

dmaiocchi23:07:07

in quickstart of clojurescript, is suggested clj isn't clj depracted in favor of clojure?

Alex Miller (Clojure team)00:07:01

clojure is the main script, clj is a wrapper designed for interactive use (adds readline support)

mfikes23:07:35

@darioszr clj isn't deprecated in favor of clojure (`clj` is really just a wrapper around clojure that adds rlwrap to make it easier to use)

👍 4
scknkkrer23:07:09

@darioszr, what kinda needs your project have ?

scknkkrer23:07:46

Are you planning just the UI, or will the Back-end join the game ?

clj 4
dmaiocchi23:07:31

The backend is already done

dmaiocchi23:07:27

I just play around. Actually currently I was trying a way to Don't install 4000 pkgs like the lein reagent projets does

dmaiocchi23:07:15

In idéal case I would like to have a webui with reagent, tomcat as server app, websocket for sync data

dmaiocchi23:07:56

Between backend and front-end. Nothing special. The thing I'm trying to figure out is mostly how can do a minimal skeleton with reagent in this env.😁

dmaiocchi23:07:34

So before having all ready i want to go the hard way, with the Lein reagent there is to much prepared

dmaiocchi23:07:59

If anyone has link for this a part the upstram doc feel free to share

dmaiocchi23:07:29

I just tried clojurescript today and I really like it:lambdalove:

scknkkrer23:07:19

@darioszr, Clojure is a hosted language. Clojurescript gives another taste of Clojure. If you really like it on the day one. Wait until it saves the day. Clojure/Clojurescript manage risks very well. So, your organization can do much more with it. --I assume your problem is right for the tool--

clj 4