Fork me on GitHub
#clojurescript
<
2017-09-12
>
souenzzo02:09:56

(inc nil) should be solved* at development time with #clojure-spec + instrumentation, don't? * Solved/detected

cjhowe02:09:43

how are people testing the rendering code in their cljs UI's? (i use om.next, so i can test the most of the logic already)

reefersleep06:09:13

@cjhowe you could use devcards?

dnolen12:09:43

@souenzzo something like that might be possible - but the issue is that we use those same arithmetic functions everywhere in the implementation of the standard lib itself

reefersleep13:09:01

@dnolen @souenzzo curious, why does that make it an issue?

reefersleep13:09:20

(I, too, was hoping for specced core to make such restrictions in core function semantics clearer)

dnolen13:09:00

@reefersleep persistent data structures rely on primitive arithmetic being fast, no checks

dnolen13:09:55

you also have many libraries written over the years with those exact same assumptions

reefersleep13:09:11

ah OK, I get the no-checks-for-speed part… I wonder if this could be circumvented somehow? Maybe give developers a large-grained choice of using specced core or not?

reefersleep13:09:21

The point about the libraries seems moot in the face of your comment much further up about the semantics being undefined. Ideally, libraries shouldn’t rely on undefined behavior… right?

dnolen13:09:20

I’m not going to get into this right now

dnolen13:09:30

but I would estimate 6 months 1 years of hammock time

dnolen13:09:42

so you have a lot of free time to think about this be my guest 🙂

reefersleep13:09:01

I’ll be sure to remember that 😉 😛

dnolen13:09:50

I would say this easily one of the hardest known problems

reefersleep13:09:56

totally get that it’s something cljs core developers have probably already put way too much thought into, and not something easily conveyed to outsiders without the proper context

reefersleep13:09:36

Wouldn’t mind being credited with solving that, then. But would probably mind the time needed 🙂

dpsutton14:09:06

does anyone have any good resources on unit testing in cljs?

souenzzo14:09:44

Where is clojure.edn/read-string ?

thheller14:09:00

cljs.reader/read-string

souenzzo15:09:13

what are the differences from clojure.edn?

john15:09:45

They're both considered "safe" EDN readers, I believe

yedi15:09:49

does anyone have any resources/examples on using core.spec to handle form input validation?

dnolen18:09:10

@dpsutton there’s really not that much to it, cljs.test more less mimics clojure.test - the only other bit is running the tests from command line and that depends on your build tool

tiagoantao20:09:53

Hi, I was wondering if one could do a (require-macros ... inside a cljs/eval-str?I am getting a error self__.rdr.cljs$tools$reader$reader_types$Reader$read_char$arity$1 is not a function

anmonteiro20:09:38

@tiagoantao pretty sure you can because I do it all the time in Lumo

anmonteiro20:09:50

can you post a snippet that’s not working for you?

tiagoantao20:09:31

The non-macro stuff works

anmonteiro20:09:57

@tiagoantao weird that it works since you’re not returning a string for the source

anmonteiro20:09:16

a cljs.core.async/go call returns a channel

anmonteiro20:09:49

your loadfn looks fishy

tiagoantao20:09:21

but works without the require-macro

tiagoantao20:09:37

(there are a couple of lines there for functions, the two other requires)

anmonteiro20:09:02

I’m not convinced

tiagoantao20:09:00

I just tested it without the require-macro

anmonteiro20:09:22

@tiagoantao try this first:

(defn loadfn [mp cb]
  (go
    (let [response (<! (http/get (str "" (:path mp)
                                   (if (nil? (:macros mp)) ".cljs" ".cljc"))))]
                                        ;(prn mp (:status response) (:body response))
      (prn mp (:status response))
      (cb {:lang :clj
           :source (:body response)}))))

pwrflx21:09:21

what's the status of clj-refactor for clojurescript? eg when I try to rename a symbol in .cljs or .cljc, it says not possible..

tiagoantao21:09:37

@anmonteiro: thanks! It now works with macros. Strangely it was working with the (require

anmonteiro21:09:00

like I said, I’m not convinced 🙂

anmonteiro21:09:40

it probably just appeared to work because the JS code was loaded in your environment

vinnyataide21:09:13

does anybody know how to resolve these warnings?

WARNING: Can't take value of macro cljs.core/use at line 9 /home/vinicius/.boot/cache/tmp/home/vinicius/Documentos/presidios-pb/4uo/-mt9ni4/static/js/app.out/om/dom.cljs

anmonteiro21:09:45

@vinnyataide which CLJS version are you on?

anmonteiro21:09:54

sounds like a warning produced in an old version

vinnyataide21:09:45

@anmonteiro

[org.clojure/clojurescript "1.9.473"
                   :exclusions [org.clojure/clojure
                                com.google.guava/guava]]

anmonteiro21:09:55

can you upgrade to 1.9.908?

vinnyataide21:09:26

is there a way to upgrade everything

vinnyataide21:09:29

im using boot

vinnyataide21:09:36

should I remove the exclusions until I fix this problem?

vinnyataide21:09:58

still same error message

anmonteiro21:09:03

the warning should just go away

vinnyataide21:09:07

@anmonteiro

java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V
clojure.lang.Compiler$CompilerException: java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V, compiling:(closure.clj:100:1)

anmonteiro21:09:02

You probably have an outdated version of Guava

vinnyataide21:09:10

ops shouldnt be posting on this thread

anmonteiro21:09:26

You should be on whatever Guava version Closure dependends on

shader21:09:54

I'm thinking of doing a cljs wrapper for the js version of libp2p (https://libp2p.io/), and eventually filling in a fully native clojure(script) implementation In the libp2p organization, the various modules are all split into separate repos... is that a good idea for a clj(s) lib, or should I just keep it to one clj-libp2p repo?

vinnyataide21:09:52

@anmonteiro still same error message

vinnyataide21:09:37

is this what they call dependency hell? =P

Matthew Davidson (kingmob)22:09:07

Can someone well-versed in dead code elimination and :npm-deps answer a question? DCE works based on what’s reachable from the :main entry point, correct? We have an old project that adds a bunch of .js files through the :preamble, but those files respond to many things outside our control (onload events, DOM mutations, global js flags, etc). If I add them via :npm-deps, will functions not directly reachable get removed? If so, is :foreign-libs a better choice?

dnolen22:09:23

@kingmob that sounds like :foreign-libs use case to me

Matthew Davidson (kingmob)22:09:41

Thx @dnolen! Does the :foreign-libs vector respect the order of libs?

Matthew Davidson (kingmob)22:09:24

And do the :foreign-libs come before the main code?

dnolen22:09:27

it’s not really a guaranteed thing if you don’t specify :requires - if you need an order then you must specify dependencies via :requires

dnolen22:09:04

@kingmob in production yes - :foreign-libs come first

Matthew Davidson (kingmob)22:09:21

Thx! Is :npm-deps similar, but for pulling from node_modules? Or could it run through :advanced optimizations?

dnolen22:09:36

:npm-deps is a completely different thing

dnolen22:09:00

it’s just for consuming node_modules and the assumption is Closure will see everything

dnolen22:09:26

whether :advanced works or not depends on the library under discussion

Matthew Davidson (kingmob)22:09:39

Got it, thanks so much. Any plans to add a flag so :npm-deps libs don’t go through Closure?

Matthew Davidson (kingmob)22:09:50

E.g., could it allow us to take advantage of npm’s deps without having to specify them manually?

dnolen22:09:30

no interest in that at this time

dnolen22:09:04

everything is going to go through Closure - if that’s not going to work for you then you need to use foreign libs

Matthew Davidson (kingmob)22:09:47

Got it. Thanks for your help.

dnolen22:09:00

but you also said something which is actually treated orthogonally anyway

dnolen22:09:16

:npm-deps is just about specifying node deps, particular useful for upstream libs

dnolen22:09:25

consuming node_modules is a separate thing

dnolen22:09:32

you can consume it without :npm-deps

dnolen22:09:04

still - my other point is unchanged - Closure is what handles node_modules in the end so whatever you consuming needs to work with :advanced

Matthew Davidson (kingmob)22:09:48

@dnolen Did I hear that Closure Compiler had some new support for consuming npm libs, or did I imagine that? I don’t see anything online… Right now, my plan is to specify what I need in package.json, and consume it in :foreign-libs. Maybe some of them can move to :npm-deps if their unreachable behavior isn’t needed.

vinnyataide23:09:16

ok just found out the problem, using datomic and cljs in same project give some inconsistency with guava