Fork me on GitHub
#beginners
<
2018-07-08
>
pez06:07:18

Haha, @ihorgorobets, are you Finnish?

perkele07:07:14

@pez No, but I have met few Finns in the Internet.

pez07:07:41

OK, your nick is one of the few Finnish words I know.

pooboy14:07:03

Clojure uses Java Threads ,right ?

pooboy14:07:27

I read somewhere that clojure has STM concurrency model ..

pooboy14:07:36

What is that ?

pooboy14:07:04

Different from Erlang actors and scala akka ..I guess

tbaldridge16:07:28

STM is a way of mutating refs, with the ability to rollback transactions, without other threads ever seeing a half-updated state.

❤️ 4
tbaldridge16:07:02

Although it is a feature that isn’t used much, it’s more common to store all state in a single mutable place

petr.mensik21:07:50

How do instantiate class in a var? I have imported SearchFilter$ContainsSubstring into namespace and I have (def clazz SearchFilter$ContainsSubstring). How do I instantiate an object from this clazz var (`new` won't recognize it)?

hoopes22:07:47

hello - is it possible to test cljs without compiling to js? it looks like all tutorials use lein doo phantomjs, but i’d like to just lein test and test my clojure functions. i’m using re-frame, fwiw - i’ve used the lein re-frame template, which gave me a runner.cljs with doo-tests in it. Is there an easy way to set up lein to run the tests without going all the way to js? Thanks very much in advance!

noisesmith22:07:29

why not put the tests in clj files, which require the cljc files with the code?

hoopes22:07:59

that would run them on the jvm?

noisesmith22:07:21

then it would be no different than what lein test does in a pure jvm project, if configured correctly, yes

hoopes22:07:41

i guess that makes sense that that’s the only way to deal with the code without compiling it to js?

noisesmith22:07:24

there's honestly many ways to do this. clojure.test can be used from a repl directly without using lein or any other build tool

noisesmith22:07:05

but if you are using lein, making clj test files and using lein test is probably simplest

hoopes22:07:36

ok, thanks - it feels a little weird to build a cljs project in cljc just to test the clojure code directly

hoopes22:07:47

i will experiment with that, thanks for your time!

hoopes22:07:52

appreciate it

mfikes22:07:03

@hoopes You could test your ClojureScript code using Node.js (if what you are really trying to avoid is spinning up a test browser environment)

hoopes22:07:57

true - i use karma and headless chrome with my js now, and i don’t have like a rational reason why i feel like i should be able to test (fn [] (+ 1 1)) without opening chrome (node aside)….you know what i mean? node might be the best bet then

mfikes22:07:16

If you are using Cursive, then going the *.cljc route does have an advantage in that integrated support for testing is better for Clojure than ClojureScript.

hoopes22:07:27

(i don’t wanna sound like i’m complaining! i’m having an awesome time)

hoopes22:07:51

i’m just using vim right now, with figwheel in another tab