Fork me on GitHub
#clojurescript
<
2015-09-23
>
wildermuthn01:09:50

So, just had to share my ClojureScript joy of the day. I’ve got ClojureScript running in both the browser and nodejs, with both running on Figwheel, and communicating via websockets. Full-stack ClojureScript? Crazy, or beautiful?? 😄

wildermuthn01:09:00

Next step is syncing my DataScript datom diffs across all connected clients.

bhauman03:09:52

@wildermuthn: Congrats!!! It's kind of a strange place to be heh? The client and the server using the same exact hot loaded code, its kind of disorienting.

wildermuthn03:09:04

Definitely top-ten mind-blowing experiences. The figwheel guide made it very simple to get going. It reminds me of trying VR for the first time. Conversion on the spot. simple_smile

timfield06:09:51

@wildermuthn: did you follow a guide to get this setup? Could you share any tips? Thanks

cddr06:09:23

cljx is kinda deprecated now right? What's a good example of a project that uses ".cljc" to good effect to provide portable code?

danielgrosse06:09:07

@noprompt: What are the advantages of generating CSS with Clojure?

cddr06:09:02

Same sort of advantages you might derive from SASS, or SCSS.

mccraigmccraig07:09:28

@cddr cats is my goto example of cljc portability https://github.com/funcool/cats

quantisan07:09:21

how might you translate this jquery into google closure please? $(document).foo()

afhammad08:09:58

@quantisan: what are you trying to do?

darwin08:09:13

@danielgrosse: in general: you treat CSS as data, so you can apply functional composition and transformations to it before you generate final CSS (using familiar clojure libraries), think of it as SASS/LESS with macros. A second big advantage is that you can share constants and other data between your app and css. Really nice when you need to generate some styles inline during your component rendering, but they have to match other CSS rules or share animation timings between javascript and CSS. Real world example: https://github.com/darwin/faceboard/tree/master/frontend/styles/faceboard

quantisan08:09:36

@afhammad: calling a jquery lib without using jquery in the cljs code

quantisan08:09:55

perhaps not a good idea?

darwin08:09:56

@afhammad: if that jquery lib uses jquery, then jquery is already present in your page, right? why not using it?

darwin08:09:39

foo is a jquery plugin?

quantisan08:09:40

@darwin: just don't want to import it in the cljs project for that one line

quantisan08:09:53

thought there's a trivial way to do it but I guess not

darwin08:09:01

@quantisan: I guess my question is if foo is a native dom function or it is a jquery method, or some jquery plugin method

quantisan08:09:25

frankly i'm not sure

darwin08:09:35

what is foo?

quantisan08:09:38

it's Foundation 5.5

darwin08:09:37

@quantisan: just skimmed their docs, it looks like they depend on jquery and they implemented their api as jquery plugin only

darwin08:09:17

@quantisan: so, if that’s true, you have no option to not include jquery, it will be included

quantisan08:09:48

got it, thanks a lot for looking! @darwin

darwin08:09:34

just checked their github code here and I can confirm their code heavily depends on jquery https://github.com/zurb/foundation/tree/master/js/foundation

darwin08:09:48

@quantisan: simply make sure you included proper version of jquery into the document and call their api via (.foundation (js/$ js/document) <args>)

bo09:09:40

Hmm when using :optimizations :advanced, I'm not expecting the output file to be including information about the source file path, yet I'm seeing many many references to the source file, encoding my local file path in the file. That's unexpected, given such files are targeting production environments. Am I crazy?

bo09:09:03

e.g. where I noticed it in a diff ^

fdserr09:09:45

@cddr You already mentioned a pretty clean cljc project. The hard part is getting the tooling straight. @pri has done a wonderful job on this side, see facjure/garderner.

darwin09:09:35

@bo: it is likely your fault, I guess some macro is emitting those strings, production logging maybe?

bo09:09:03

@darwin: no such logging that I am aware of

bo09:09:08

this is just some small cljs for a blog post

bo09:09:27

@darwin: and no such string appears in any output file with non-advanced compilation

bo09:09:27

:pseudo-names defaults to true, so I am not sure if you meant to set it to false

bo09:09:37

either way, it makes no discernible difference

darwin09:09:57

@bo: pseudo names is definitely not true in your screenshot

bo09:09:35

oh sorry misread wiki, it defaults to false

bo09:09:33

@darwin: toggling pseudo-names definitely changed the output, but the paths are still present

darwin09:09:16

@bo: paste example

bo09:09:36

+    return $mujic$chords$$;
+  }, $cljs$core$cst$0sym$0mujic_SLASH_chords$$, $cljs$core$PersistentHashMap$fromArrays$$([$cljs$core$cst$0kw$0ns$$, $cljs$core$cst$0kw$0name$$, $cljs$core$cst$0kw$0file$$, $cljs$core$cst$0kw$0end_DASH_column$$, $cljs$core$cst$0kw$0column$$, $cljs$core$cst$0kw$0line$$, $cljs$core$cst$0kw$0end_DASH_line$$, $cljs$core$cst$0kw$0arglists$$, $cljs$core$cst$0kw$0doc$$, $cljs$core$cst$0kw$0test$$], [$cljs$core$cst$0sym$0mujic$$, $cljs$core$cst$0sym$0chords$$, "/Users/bjeanes/Code/mujic/src/mujic.cljc",

darwin09:09:36

now we will be able to actually reason about the source of the problem

bo09:09:00

ugh this is form the diff so probably not the most useful

bo09:09:04

let me see if I can find a saner example

darwin09:09:48

I guess that got emitted from assert in :pre or :post conditions

darwin09:09:15

:elide-asserts true

darwin09:09:21

^ you should do that

bo09:09:05

OK I'll try that.

bo09:09:51

The src code that I think this corresponds to is using ns-interns which very likely is including this extensive metadata

bo09:09:40

@darwin: it doesn't seem to be asserts, but the metadata associated with the interns seems more likely. I'm guessing ns-interns is a macro which is causing all the interns and the full associated data to to be written out and slurped up by Closure, even though I'm only using the intern names

bo09:09:12

Interesting that I can't see this metadata with :optimizations :none though. I'd expect it have a superset of information, not a subset

darwin09:09:20

@bo: maybe you could paste a gist?

bo09:09:25

of the src code?

asolovyov09:09:28

When I start cljs autocompilation, I get 'clojure.lang.ExceptionInfo: failed compiling file:src/mk/fe/router.cljs`. If I change anything, compiler complains with java.io.FileNotFoundException: Could not locate core/utils__init.class or core/utils.clj on classpath. I surely don't have core/utils.clj, but I have mk/fe/core/utils.clj, and I require it like that everywhere. Any thoughts what's going wrong here? I tried cleaning up artifacts already...

darwin09:09:12

@bo: you should be able to fix it with a simple re-writing macro, where you cherry-pick only stuff you care about

bo09:09:41

darwin: yeah now that I have somewhat of an idea where the problem is, that was my thinking also

darwin09:09:06

@bo: yes, that’s the ns-interns call, it generates (into {} [bunch-of-stuff]) this won’t get optimized away by closure

bo09:09:24

cool, thanks for helping me narrow that down

bo09:09:44

I still don't know why I can't find the same junk in the non-advanced compilation, but maybe it's just not where I am looking

bo09:09:20

this should cut down the .js file size by a bit too hah

darwin09:09:45

@bo: it will be in cljs/core.js

bo09:09:38

@darwin: the only place I can find that string in the output-in dir is in the .cache.edn file

darwin09:09:55

it should be in the same place, not sure why is it not there

bo09:09:15

yeah me neither. This is the main reason I thought I was going insane

darwin09:09:26

maybe advanced compilation keeps richer data about which ns-interns happily emits

bo09:09:15

@darwin: yeah actually I'm looking at the output of the same section, now that I know the source, and it seems to be using relative paths instead of absolute

bo09:09:35

e.g.

var intern_kv = cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.PersistentVector.fromArray([new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.symbol.call(null,"chords"),new cljs.core.Var(function(){return mujic.chords;},new cljs.core.Symbol("mujic","chords","mujic/chords",1711103068,null),cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"ns","ns",441598760),new cljs.core.Keyword(null,"name","name",1843675177),new cljs.core.Keyword(null,"file","file",-1269645878),new cljs.core.Keyword(null,"end-column","end-column",1425389514),new cljs.core.Keyword(null,"column","column",2078222095),new cljs.core.Keyword(null,"line","line",212345235),new cljs.core.Keyword(null,"end-line","end-line",1837326455), ...

darwin09:09:40

@bo: make sense

bo09:09:48

ugh bad example actually, but you get the point

bo09:09:54

new cljs.core.Symbol(null,"chords","chords",1875513344,null),"src/mujic.cljc",12,1,448,448,cljs.core.List.EMPTY,null,(cljs.core.truth_(mujic.chords)?mujic.chords.cljs$lang$test:null)]))], null)

bo09:09:05

src/mujic.cljc vs ~/Code/mujic/src/mujic.cljc

bo09:09:03

I'm kinda surprised, tbh. absolute paths in a production compile feels useless-ish

darwin09:09:14

@bo: you will have to write your own specialised version of ns-interns or use some narrower api-call to fetch only what you need

darwin09:09:26

I’m not familiar with ns-interns

bo09:09:28

yeah totally

bo09:09:30

i have a few ideas

bo09:09:50

I can also be less clever there. this was just a temporary little thing to let me defer wiring up my interactive examples in the post

bo09:09:15

I could just be explicit, but if not, a macro here should definitely do the trick

darwin09:09:53

@bo: good luck, btw. just checking the page, cool creative use of clojure there simple_smile

bo09:09:06

@darwin: thanks! It's been a super fun project simple_smile

bo09:09:54

And it led me to a ClojureScript bug and subsequent patch due to my use of a ♯ symbol in keywords 😉

ricardo10:09:42

Anyone using khroma or writing Chrome extensions in ClojureScript? https://github.com/suprematic/khroma/tree/develop I’m extending it, so if anyone has notes or comments, now’s the time.

ricardo10:09:11

I’m also wondering about the best approach for writing tests for something like khroma, since lots of functions aren’t present unless you’re running as an extension with the right permissions. My current thinking to make a Chrome extension that presents a set of devcards with the test results.

cfleming10:09:49

@ricardo: I haven’t but I would like to in the future - I’m interested in your experiences using it.

ricardo10:09:48

@cfleming: It’s very bare-bones and barely documented. I’m adding wrappers for functions that I need, improving function docstrings, renaming for consistency, that sort of thing.

ricardo10:09:56

Will probably do the tests before I take it much further.

ricardo10:09:24

But it gets the job done, and it’s a good starting point.

cfleming10:09:43

@ricardo: Sounds good. It’ll be a while before I need it, but I’m glad there’s something there - I searched a while back and couldn’t see anything.

darwin10:09:17

I wonder if there is a way for macro to require dependency in case it wasn’t already required. In my homebrew macros I learned to use fully specified method names including namespaces, but still there is that pesky problem that macro user has to have the namespace required at call site when using the macro. Those requires seems to be unnecessary to unaware reader. I usually tend to remove them during code cleanups and then learn hard way that they were needed by some macro actually. How do you guys deal with this?

colin.yates11:09:06

@wildermuthn: Congrats - it is a great place to be. I am using Clojure/ClojureScript with EDN and it just rocks.

colin.yates11:09:16

@danielgrosse: The other win for CSS in Clojure is the symmetry between hiccup and keywords. Jumping between hiccup-style and then SCSS (or plain CSS) just jars. The number of times I have typed .myclass { :width 10 } in CSS and then scratched my head….

dnolen12:09:53

@darwin give the ns and the macro ns the same name. Then require like so (:require (my.foo :refer-macros [bar]))

dnolen12:09:50

@asolovyov: you’ve expressed something less than Clojure 1.7 as a dep

darwin12:09:34

@dnolen: thanks, will try to do, but not always macros reside in the same namespace, sometimes I want to write macro which does some work generating code using functionality from other namespaces (e.g. macros which sugar usage of a 3rd party library)

dnolen12:09:48

@bo: it doesn’t matter what optimization setting you use, ns-interns will dump vars, remove it if you don’t want that

dnolen12:09:03

@darwin there’s no better solution to that problem and unlikely to be - the same story in Clojure really, you can’t refer to stuff no one ever loaded

pupeno12:09:07

Finally, my NodeJS powered library for pre-rendering ClojureScript applications is ready: https://carouselapps.com/prerenderer/

asolovyov12:09:57

@dnolen: I thought so! But I found it just 20 mins ago - it was lacking a dep somewhere in the unrelated module. Figwheel actually showed me better error in overlay, I just didn't pay attention there

mbertheau12:09:10

This is my first macro. If someone can take a look at it and point out shortcomings, I'd appreciate that! https://gist.github.com/mbertheau/3a90c1bc46ea660bc8ea

joelkuiper13:09:09

Hey all, I’m including some stuff as web-jars. Right now I just <script> import each of them in the html; but is there a better way of combining them?

joelkuiper13:09:37

(in this particular case it’s react and react-boostrap (using Reagent, but getting react-bootrap to work requires explicitly importing it on the window)

dnolen13:09:23

@joelkuiper: this is why most people don’t use Webjars much with ClojureScript, if you use CLJSJS you get dependency ordering and even more important you get externs

dnolen13:09:49

if you use WebJars you must be prepared to supply all externs yourself

joelkuiper13:09:07

right, but that makes the interpop story with existing libraries (like react-bootstrap) a bit tricky

dnolen13:09:27

@joelkuiper: c’est la vie, this is how ClojureScript works today

joelkuiper13:09:34

fair enough simple_smile

dnolen13:09:12

@joelkuiper: I see that CLJSJS has react-bootstrap btw, http://cljsjs.github.io

joelkuiper13:09:37

ah, thanks! Might try that instead!

csmith13:09:47

Can confirm. Using react-bootstrap from CLJSJS over here FWIW. Works well enough

dnolen13:09:55

@joelkuiper: the order you should try things

dnolen13:09:12

1) cljs.core 2) Google Closure 3) CLJSJS 4) random JS thing on the internet

dnolen13:09:33

I personally would never goto 4

joelkuiper13:09:45

good to know, I’ll try and see if I can get it to work with the CLJSJS lib simple_smile thanks!

colin.yates13:09:19

@joelkuiper I am continually surprised by how rich 2) turns out to be, so my list would be 1), 2), 2), (really sure?) 2) 3)

dnolen13:09:38

2) is a gold mine

dnolen13:09:02

unbelievably battle-tested and guaranteed to work well with your ClojureScript

colin.yates13:09:30

@dnolen: I find it about as accessible as a gold mine unfortunately - is there a good pick-axe (e.g. high-level guided tour documentation) you know of?

dnolen13:09:22

@colin.yates: that’s the primary issue with it, the only saving grace is that it’s well commented / readable JavaScript

dnolen13:09:38

that said it’s kinda of like the JDK, you eventually find your way around

dnolen13:09:13

but I rather do that than fight with build issues due to a random JS library

colin.yates13:09:38

fair enough - thanks.

dnolen13:09:02

it might be a good idea for http://cljs.info or something like it to provide the high level docs for commonly used GCL namespaces not sure what @shaunlebron thinks about that.

dnolen13:09:43

goog.assert, goog.math, goog.date, goog.string, goog.object, async module loading, internationalization, dom helpers, event stuff, etc.

dnolen13:09:59

it would be great to document these in a more visible way for a ClojureScript audience

dnolen13:09:10

there are various bits in the GCL testing lib which are pretty slick (I used PRNG for CLJS test.check), the crypto stuff is useful etc.

joelkuiper13:09:05

@dnolen: CLJSJS worked perfectly, thanks simple_smile

colin.yates13:09:21

+1 - I found out to write an auto-reconnecting websocket client is three lines for example.

colin.yates13:09:49

time I imagine, as ever, is the constraint though

dnolen13:09:18

@colin.yates: a wiki approach seems to work with the ClojureScript community, there just needs to be a convenient wiki to send PRs to

colin.yates13:09:39

a github book might be the thing then...

colin.yates13:09:54

never mind - I thought it was free for open-source books

bhauman13:09:03

@dnolen @darwin I'm getting on a plane but it occurs to me that it could be possible to analyze/compile a cljs ns dynamically in a macro definition. Yes yes nasty hack

dnolen13:09:21

@bhauman: never going to do that simple_smile

dnolen13:09:29

this is just not a problem we care to solve

darwin13:09:00

@bhauman: I was just thinking about the same simple_smile

bhauman13:09:34

2) has many codes paths that are exercised billions of times a week

darwin13:09:21

I was thinking about wrapping whole file in a macro call, but I rejected it, maybe if cljs compiler had option to wrap each file in a form specified on as compiler option, but still it could bring more troubles, with ides and other tools

bhauman13:09:19

@darwin I think a wrapper ns for the main namespace that includes the libraries will work. Warnings will get thrown on first compile.

darwin13:09:15

@bhauman: I’m not sure if I follow. how would that macro know about something which is coming later and referencing lib xxx?

darwin13:09:00

I was thinking about deep-walking macro which would get fully expanded file and just add missing requires

bhauman13:09:02

Also if we could specify an ns as a build input to the compiler you could do conditional includes that way as well.

bhauman13:09:59

That's not gonna work

darwin14:09:23

@bhauman: a different topic: in one of your talk I saw that you used figwheel as continuous testing environment, you had a web page with your test results and did that cool favicon trick when something failed, pretty sweet, do you plan adding something like that into figwheel or maybe thinking about another library on top of figwheel maybe part of devcards?

darwin14:09:05

Over last two days I wasted some hours trying to make karma runner work this way, but it was mission impossible

darwin14:09:45

I’m thinking also about clojurescript-specific tool which would be smart enough to re-run only tests affected by code changes

bhauman14:09:48

@darwin if you look at the crashverse repo its in there

darwin14:09:33

the idea of running tests in browser directly is neat, because if something goes wrong you have debugger at hand to peek into it

darwin14:09:55

I mean running them figwheel-style

darwin14:09:18

ok, will look, thanks

bhauman14:09:19

Yeah me too!

mbertheau14:09:25

How is (for [example [1 2]] (button-cell example)) different from (map button-cell [1 2])? I'm getting Wrong number of args (1) passed to app.widgets/button-cell for the for variant.

bhauman14:09:30

@darwin is the devcard testing working for you

darwin14:09:22

@bhauman: yes, I have a scaffold which works, haven’t got to writing real tests yet

darwin14:09:12

will use my own deftest macro, which can do devcards' deftest or something else depending on situation, but from top-level it will have deftest shape

darwin14:09:11

just for record, if someone wanted to use karma watching cljsbuild auto mode, it is not working fo me under OSX, karma does not wait for files to be fully written and corrupts its own caches: https://github.com/darwin/plastic/commit/8e7ccecbbd51b7b87d95362293732d29b4444e89

darwin14:09:07

not sure whose fault it is, but I guess clojurescript compiler is not doing anything crazy when writing files

darwin14:09:36

maybe it is just a bit slower in writing file contents and exposes karma’s bug that way

dnolen14:09:03

so I posted this in the #C06DT2YSY channel last night but might as well posted here https://github.com/swannodette/om-next-demo. Presented with little in the way of docs or how to run it, but still might be of interest to anyone who has been following Relay/Falcor or the various tidbits I’ve shared about Om

dnolen14:09:20

still under heavy dev, but getting pretty excited about how it allows you to determine how much reactive logic you split between server and client. this is a direct result from Falcor providing unified client/server routing model.

dnolen14:09:40

this means it’s easy to write a rich server which reflects back changes to the client, and the client becomes very simple and very declarative.

dnolen14:09:57

but also easy to not worry about server at all and drop in DataScript or whatever

dnolen14:09:13

also psyched about no cursors

dnolen14:09:48

most of the server side stuff can be completely ignored in that repo, typical Clojure web app boilerplate

dnolen14:09:53

is the good stuff

dnolen14:09:15

can see that client becomes super declarative once you colocate queries, they present data and trigger mutations (some which may run on client some which may run on the server - this is important).

dnolen14:09:13

this is context for my oblique tweet simple_smile basically instead of sending HTML fragments around, Om apps are data deltas managed by queries

dnolen14:09:39

so we get the benefits of Relay for page load, but we also index every single component in the UI - so if the server says update this logical identity Om can find every rendered instance of the thing and update that too. This is Falcor-ish.

darwin15:09:20

it is possible to (deftype MyThing []) and have MyThing inherit all PersistentHashMap protocols?

dnolen15:09:41

not in a generic way anyway

dnolen15:09:52

could probably hack it in CLJS because of JS prototypes

darwin15:09:26

@dnolen: ok, thanks, was wondering, started with plain map and now would like to turn it into deftype and add some protocols

dnolen16:09:07

@darwin this is what records are for, unless for some reason you can’t use its defaults

darwin16:09:59

@dnolen: I was feeling that record is too heavyweight for my case, I just wanted a type validation checks, will stick with plain PersistentHashMap

dnolen16:09:27

@darwin: I don’t know what you mean by “heavyweight"

dnolen16:09:58

but yeah if you wanted type validation checks that’s not going to work for that

darwin16:09:57

@dnolen: record does a lot stuff, not sure about performance of construction and map functionality, maybe it is ok, never used records much before

dnolen16:09:14

records aren’t slow

val_waeselynck16:09:16

@mbertheau no difference AFAIK must be a lazyness issue

dnolen16:09:28

they’ll be faster than any Map like thing you would ever write by hand

dnolen16:09:44

unless you just copy what it does of course simple_smile

darwin16:09:51

@dnolen: ok, will read more about them and consider it

dnolen16:09:26

for example records keys lookup compiles to a switch statement on strings, this is way faster than hashing to find a value, the only thing that might be faster than this would be a small array-map with a couple of keys.

dnolen16:09:54

re: construction, if you use the raw ctor, no real construction overhead worth talking about

dnolen16:09:49

the primary down side of records everything is prebaked, and that two records of different type but same keys will fail equality.

bhauman16:09:52

Oh jeez now I'm going spend my time reading om next demos instead of working on my Strange Loop talk. Thanks a lot David

darwin16:09:49

@dnolen: my map is dynamic, I wouldn’t specify any record params and rely on it’s dynamic nature, I assume it would boil down to same performance as PersistentHashMap

dnolen16:09:31

@darwin yes if you cannot provide a basis, then less useful

darwin16:09:43

also I rely on transients on that map

dnolen16:09:30

yeah records don’t support transients, but update perf on basis keys isn’t going to be slow.

darwin16:09:47

@dnolen: thanks for all the info, btw. speaking about transients, would be nice to provide printing support for them

dnolen16:09:12

@darwin: another question to sort out in Clojure first, discuss after that, then maybe consider it for ClojureScript

dnolen16:09:39

rule of thumb if you think some language enhancement might be interesting it generally needs to pass muster or gather rationale from Clojure first

dnolen16:09:30

Alex Miller is basically always in #C06E3HYPR waiting to answer stuff like this

dnolen16:09:39

perhaps not over the next couple of days because of Strange Loop of course

darwin16:09:54

@dnolen: ok, will go there, didn’t know about that channel

martinklepsch16:09:38

@dnolen: is there something like cljs.analyzer/error-message that’s public? Wondering how figwheel creates it’s warning messages

dnolen16:09:13

@martinklepsch: might not be but not for any particularly reason, that’s definitely something to export into a public ns

mbertheau17:09:39

@val_waeselynck: Ah, laziness. Thanks! simple_smile

tel18:09:20

are unsynchronized-mutable and volatile-mutable both available in deftypes?

tel18:09:27

and if so, how do they differ for js?

tel18:09:49

is one preferred?

gtrak18:09:15

I can't imagine how they could be, since it's es3.

gtrak18:09:29

and there's no multithreading.

esp119:09:06

i just noticed that in clojurescript 0 is no longer truthy

esp119:09:19

try: (if 0 :y :n) in a cljs repl

esp119:09:34

it’s returning :n

esp119:09:43

if you do the same in a clojure repl you’ll get :y

dnolen19:09:15

@esp1 you need to be more specific about “cljs repl"

dnolen19:09:33

likely you’re not using a standard one

esp119:09:38

current version of planck, also http://clojurescript.net

dnolen19:09:10

these are all 3rd party things with 3rd party issues running on a bleeding edge feature - optional bootstrap

dnolen19:09:24

ClojureScript has tests for this stuff

esp119:09:52

i c thx. i’ll ping mfikes about it then

dnolen19:09:10

@tel in ClojureScript those are just synonyms for :mutable hint

esp119:09:00

@mfikes were you aware about 0 being falsey? i was typing up an issue for planck when u ponged me simple_smile

dnolen19:09:00

@mfikes I though that was fixed in planck, I don’t believe we understand the root cause of the issue though

mfikes19:09:14

@esp1: No, that is new to me… it recrudesces evidently.

esp119:09:02

uh, okay (looks up recrudesces) ^^;

dnolen19:09:27

@mfikes right but that ticket doesn’t have enough to go on.

dnolen19:09:38

most of the places where we would call that are bookended

dnolen19:09:50

so we need to know where that unset call is missing

mfikes19:09:09

@dnolen: Yeah… that ticket is only minimal in the sense that it doesn’t involve 3rd party things like Planck. But it currently only goes so far as to show requiring cljs.anayzer can cause it. Hrm.

dnolen19:09:43

@mfikes the case doesn’t explore the fact that in a bootstrapped context cljs.analyzer/*unchecked-if* doesn’t exist

dnolen19:09:59

only cljs.core/*unchecked-if*, would be useful to see what the value of that is

dnolen19:09:58

@mfikes a Planck REPL shows that cljs.core/*unchecked-if* is indeed false

mfikes19:09:34

@dnolen: I'll take a look at that ticket again. My last memories if it involved trying and failing to construct metacircular arguments that would explain the behavior. :)

shaunlebron20:09:10

@dnolen: I can’t seem to create a controlled component in Om anymore. minimal bug reproduced: https://github.com/shaunlebron/om-control-bug

shaunlebron20:09:59

(dom/textarea #js {:onChange (fn[]) :value (:text data)}) should be the same as <textarea onChange={(function(){}} value={this.props.value}/> but adding an empty onChange event in Om makes the state get out of sync for some reason

bensu20:09:14

@shaunlebron: I'm not sure I understand correctly but it seems like that has always been the intended behavior

bensu20:09:11

if there is a handler use it

shaunlebron20:09:09

@bensu: oh thanks, that explains exactly why that’s happening

shaunlebron20:09:06

having said that, this is at odds with trying to prevent certain states in the textarea

shaunlebron20:09:10

e.g. preventing characters from being typed

bensu20:09:13

@shaunlebron: I'm not sure what is desirable but that is how I remember it working since.... well forever.

shaunlebron20:09:11

I don’t have access to my old Om code base, but I had to prevent invalid date strings in an input field by cleaning the text in onChange

bensu20:09:18

IIRC the way to do that was to provide :onChange, filter the chars, and handle it yourself. I think it's covered in the om intermediate tutorial.

shaunlebron20:09:19

not sure how I did that now

bensu20:09:30

I'll look it up then!

bensu20:09:51

then ctrl+f for number

bensu21:09:05

and there is an example of an only-numbers input field

shaunlebron21:09:27

@bensu, thanks, that’s the behavior that I expect actually

shaunlebron21:09:55

the app still allows me to type “x”

bensu21:09:03

you are missing (.. e -target -value)

bensu21:09:21

the argument to :onChange is an event, not a string

bensu21:09:15

@shaunlebron: that looks correct. I'll try it out

shaunlebron21:09:48

@bensu: typing axxxaxxxaxxxa will only refresh the component when you type a, bug must be related to change detection

bensu21:09:20

@shaunlebron: I got to the same conclusion, after typing

bensu21:09:16

but there is definitely a bug somewhere.

shaunlebron21:09:32

@bensu: thanks for looking at it

bensu21:09:37

since you should never see x on the first place

bensu21:09:05

no problem. I'm very invested in om and this kind of work saves me time in the future.

bensu21:09:31

the problem is not on change detection since the callback gets called on every keystroke

bensu21:09:28

app-state is also properly updated

bensu21:09:42

and the bug can be reproduced for dom/input as well

shaunlebron21:09:41

@bensu: I think Om only schedules updates when app-state changes. the app-state value doesn’t change when you type an “x” so the component is never updated

bensu21:09:47

for this case, you want to have the when-not to be a if-not

bensu21:09:01

or, to avoid editing the local state.

bensu21:09:48

no, I'm sorry, I'm not sure if that is right.

shaunlebron21:09:31

I don’t see why value is being kept in local state

shaunlebron21:09:32

I think that’s the source of the problem though

bensu21:09:29

IIRC React already has some magic behavior around inputs and for implementation reasons om can't leverage directly. then it has to provide it's own input layer which is dependent on the React version/implementaiton. I think this is where the bug comes from.

nha21:09:37

Hello, adding https://github.com/onyx-platform/onyx seem to make my lein figwheel command fail, did anyone experienced something similar ?

bensu21:09:48

I'll try your code on an older om version and see what happens

shaunlebron21:09:48

I mean, I see why it’s happening, the local state is being changed, which triggers a component update, and of course it uses the local state value

shaunlebron21:09:06

completely ignoring the prop

shaunlebron21:09:54

I gotta grab dinner

bensu21:09:05

I gotta go to bed simple_smile

bensu21:09:11

but we'll sort this thing out

nha22:09:55

Well it throws a reader exception

nha22:09:23

Exception in thread "main" java.lang.ExceptionInInitializerError, compiling:(cljs/repl.cljc:1:1)
	at clojure.lang.Compiler.load(Compiler.java:7239)
.....
Caused by: java.io.FileNotFoundException: Could not locate clojure/tools/reader/impl/ExceptionInfo__init.class or clojure/tools/reader/impl/ExceptionInfo.clj on classpath.
	at clojure.lang.RT.load(RT.java:449)

bensu22:09:13

which onyx version are you using?

nha22:09:20

I tried different versions of both onyx, fighwheel

nha22:09:27

0.7.5 right now for onyx

nha22:09:50

but I tried also 0.7.4 and 0.7.3

nha22:09:20

for figwheel I have 0.4.0 but I tried 0.3.9 as well

bensu22:09:22

it looks like a cljc problem. you are using clojurescript that requires cljc files but a clojure version that can't

bensu22:09:36

can you try lein repl?

nha22:09:41

hmm I am using 1.7.0, lein repl gives :

`
nREPL server started on port 53988 on host 127.0.0.1 - 
REPL-y 0.3.7, nREPL 0.2.10
Clojure 1.7.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_60-b27
`

bensu22:09:34

right, then it's not that.

nha22:09:05

I tried importing [org.clojure/tools.reader "0.10.0-alpha1”] as well

bensu22:09:36

try lein deps :tree and see if there are any conflicts for the clojurescript versions

nha22:09:03

the output it quite big, but at the beginning I have :

`
Possibly confusing dependencies found:
[lein-ancient "0.6.7"] -> [org.clojure/tools.reader "0.9.1"]
 overrides
[lein-figwheel "0.4.0"] -> [figwheel-sidecar "0.4.0"] -> [clojurescript-build "0.1.9"] -> [org.clojure/clojurescript "1.7.48"] -> [org.clojure/tools.reader "0.10.0-alpha3"]
 and
[lein-figwheel "0.4.0"] -> [figwheel-sidecar "0.4.0"] -> [figwheel "0.4.0"] -> [org.clojure/clojurescript "1.7.122" :exclusions [org.apache.ant/ant]] -> [org.clojure/tools.reader "0.10.0-alpha3"]
 and
[lein-figwheel "0.4.0"] -> [figwheel "0.4.0"] -> [org.clojure/clojurescript "1.7.122" :exclusions [org.apache.ant/ant]] -> [org.clojure/tools.reader "0.10.0-alpha3"]
 and
[lein-figwheel "0.4.0"] -> [figwheel-sidecar "0.4.0"] -> [org.clojure/clojurescript "1.7.122" :exclusions [org.apache.ant/ant]] -> [org.clojure/tools.reader "0.10.0-alpha3"]

Consider using these exclusions:
[lein-figwheel "0.4.0" :exclusions [org.clojure/tools.reader]]
[lein-figwheel "0.4.0" :exclusions [org.clojure/tools.reader]]
[lein-figwheel "0.4.0" :exclusions [org.clojure/tools.reader]]
[lein-figwheel "0.4.0" :exclusions [org.clojure/tools.reader]]

bensu22:09:59

clojurescript is not there!

dnolen22:09:10

@shaunlebron: pretty sure you have to use to component local state to make controlled components works, you can’t do it via app state.

nha22:09:09

ow. I commented it I think when testing combinations.

bensu22:09:39

is that it then?

nha22:09:57

well no it's still the same with [org.clojure/clojurescript "1.7.48"]

bensu22:09:12

can you send the tree again

bensu22:09:29

@dnolen: I failed to notice that the tutorial uses local state.

nha22:09:29

here is is, now with clojurescipt (and thanks for your attention by the way)

bensu22:09:31

so, it might be this: clojurescript requires [org.clojure/tools.reader "0.10.0-alpha1"] to find cljc files and for some reason your deps (`lein-ancient`) are bringing in an older version

nha22:09:05

ah I see. let me disable it

bensu22:09:46

reloaded repl?

nha22:09:25

That's basically a wrapper for helper functions in a user.clj

nha22:09:46

wrapper functions for stuartsierra component

bensu22:09:22

it might be totally unrelated but it includes [tools.namespace 0.2.11] can you try with it?

nha22:09:35

without ? ok

bensu22:09:56

without yes.

nha22:09:35

hmm still exactly the same

nha22:09:02

(and I will have to go to sleep also ^^)

bensu22:09:20

yeah... checking that and tools.analyzer was my last idea. I would try binary search on the dependencies now.

nha22:09:38

well I have reduced the dependencies before posting quite a bit (now I have clojure, clojurescript, aleph, timbre, component, onyx, figwheel as a plugin)

nha22:09:49

but yes that's probably something like that

nha22:09:04

maybe in the plugins. Thanks for your help !

danielcompton23:09:16

Anyone here using lein doo?

danielcompton23:09:50

I’m able to run it fine from my computer, and I can run it on CircleCI, but sometimes on Circle it’s blowing the memory usage up over 4GB and failing the build