This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-15
Channels
- # beginners (34)
- # boot (45)
- # cider (16)
- # cljs-dev (20)
- # cljsjs (1)
- # cljsrn (8)
- # clojure (207)
- # clojure-berlin (3)
- # clojure-dev (18)
- # clojure-greece (1)
- # clojure-ireland (1)
- # clojure-italy (9)
- # clojure-russia (20)
- # clojure-spec (27)
- # clojure-uk (19)
- # clojurescript (110)
- # code-reviews (2)
- # cursive (7)
- # data-science (2)
- # datomic (7)
- # devcards (1)
- # emacs (4)
- # graphql (1)
- # hoplon (2)
- # immutant (15)
- # jobs (5)
- # jobs-rus (1)
- # juxt (1)
- # luminus (7)
- # lumo (26)
- # microservices (3)
- # off-topic (27)
- # om (13)
- # onyx (11)
- # pedestal (7)
- # proton (4)
- # re-frame (24)
- # remote-jobs (1)
- # spacemacs (2)
- # specter (2)
- # unrepl (31)
- # untangled (7)
- # vim (14)
Newest version of Clojurescript breaks code that uses Plumatic Schema https://groups.google.com/d/msg/clojure/In88wV63QyE/5daVkzxzBgAJ
yeah, I'm using hyphens and plus signs. Trying to put a base64 string in the name of the keyword. Every once and awhile I get a reader failure. Not a lot of info in the error though.
the common lisp community usually responds to that sort of thing with a stern finger wagging
objects that are programmatically generated at runtime. and the keys refer to the objects
hmm
If -, + or . are the first character, the second character (if any) must be non-numeric.
@anmonteiro thanks for your patch on CLJS-2020 the performance numbers look fantastic.
@olivergeorge sure. Just looks like we forgot to port a patch over from Clojure
Hello. Is it possible to create tests in ClojureScript dynamically?
I've found the approach which works in Clojure: https://gist.github.com/joelittlejohn/2ecc1256e5d184d78f30fd6c4641099e#file-test-clj-L7
But it will not work in CLJS because there's no intern
.
@metametadata I don’t think it’s really posssible
@dnolen got it, thanks
@metametadata data there is something called test-ns-hook
in the sources, maybe you could hook into that and do your dynamic stuff there
@darwin thank you, I'll need to think about it!
n00b question: I'm trying to import an NPM module written in ES6 that isn't packaged for clojurescript. If I use (nodejs/require "uws")
, it returns an object that I can call the functions on with no problem. If I add it to my build script in :npm_deps
and try to require
it, I get all sorts of errors about the clojurescript compiler not knowing what to do with ES6 and telling me to use --language_in=ECMASCRIPT6
. Where do I put that flag, or is there another easy way to get it to use ES6 modules?
(I'm targeting node, not the browser)
@adamtrilling I don't know if it is the problem, but make sure it is :npm-deps
(dash)
Yeah it is. Should have copied and pasted from my code 🙂
@adamtrilling did you set :language-in :es6
in your compiler options?
should be here then: https://github.com/clojure/clojurescript/wiki/Compiler-Options#language-in-and-language-out
That worked! Now it's having trouble with the module saying const http = require('http');
But that may have to do with the module itself
So I halfway figured out my problem with keywords. I'm pr-str
ing and read-string
ing all over the place. And, in certain namespaces, some name
ed things are getting ear-muffed with whitespace. It's as if in a particular context, the object printer is using println
semantics, where spaces are interposed.
And I have a log
ging macro that adds namespace data using ~(name cljs.analyzer/*cljs-ns*)
and puts it in a ... " <" nspace ":" line-number ">" ...
string. Sometimes it prints <my.nspace:56>
and sometimes it prints < my.nspace :56>
.
and this expansion is apparently happening throughout other places as well, causing breakage randomly
I was interposing whitespace in one of my functions, but I removed it and I'm not interposing anywhere else in the project.
@thheller: picking up from Google Groups - shouldn't it be possible to run Google Closure on the output of browserify without any issues?
@rohit no, closure expects ONE global scope. but webpack&node create a scope per file
so everything is wrapped in (function (exports, require, module, __filename, __dirname) { CODE });
ah ok. I see what you mean. I was able to use it for npm-module-example
. GCC generated the minified file but it did complain.
currently I do not see this working properly in many cases so I dismissed it for now
Doesn't Rollbar do that?
Sorry, I meant Rollup
ksmithbaylor: holy wall-of-text, batman! 🙂
haha, sorry. I pasted and hit enter before seeing how big the URL was 🙂
The variables from other scopes get renamed so they don't conflict with each other, but they all end up in the same scope in the final build.
@ksmithbaylor interesting, didn't look at rollup yet
(I had to console.log each one since Rollup does some dead-code-elimination)
@rohit I didn't investigate many JS options yet. I know the closure compiler inside-out but nothing else really
@ksmithbaylor: https://medium.com/webpack/webpack-and-rollup-the-same-but-different-a41ad427058c
Yep! That's the general advice. Although for specific use-cases, it may make sense to use Rollup for apps. The main reason Webpack is a better option for apps is because of its rich plugin/loader system, which makes it really easy to load styles, images, and other assets directly in your source code. If you don't use those features (like if you only have a small portion of your app written in JS, and the rest in CLJS), then Rollup would be a perfect solution.
If there is src/foo/bar.cljs
and dev/foo/bar.cljs
, and you set your project.clj to :source-paths ["dev" "src"]
, which of the two files will take precedence with figwheel?
I wonder if devs ever decide to f- wit people on these issues by having it pick a random one, based on the day of the month, i.e. "odd numbered day? take dev" "even numbered day? take src" -- this way, it's not obvious it's random (since it's constant for any given day), but causes a new eadache every day 🙂
funny you should mention that
I think it's actually random in my experience - sometimes figwheel picks dev
, sometimes src
or pick the one with the latest modification time, that'd be evil too and hard to debug 🙂
well I actually thought I was being clever by lettings developers in our team override a namespace by adding an overriding "dev" ns
correct me if I'm wrong but this kind of hack is pretty common in Clojure, where the classpath works reliably
this is insane, people in clj dev purposely have overlapping names and predict which one the jvm picks to load ?
@pesterhazy I used to do it by having dev and rel folders and same namespaces in them, but putting only one of them into :source-paths
that always worked predictably, these days I prefer :preloads
compiler option if possible
@darwin, that would require devs to change source-paths accordingly hm...
@pesterhazy should be fairly simple, the jvm classpath decides. so in your example src
wins
@thheller that's what I thought, but that's now how it works, at least with figwheel
the whole point of this was to add a feature.cljs, which developers can keep outside revision control
so they can keep their personal copy of feature flags
if I ask developers to update project.clj to add a classpath, that sort of defeats the purpose of the exercise 🙂
there is also :source-paths
for clojure macros on project.clj root level, which might interfere with :source-paths
on cljsbuild level (assuming lein), I guess
yes, using lein here
@pesterhazy feature flags could easily be a file, you can load it as part of macro code and then decide which cljs code to emit based on it
hm right
so the problem is that you can't require a file but also ignore it if it doesn't exist
but a macro could do that
or you could put it into env: https://github.com/binaryage/env-config
indeed
I'll try the macro route
@darwin, that worked, thanks!
Just found one of those bugs where my view wouldn't update when a local state atom changed.
Problem was my deref was inside a (for...) loop and so the lazy seq wasn't evaluated yet (so no deref happened).
Good...
(into [:tbody]
(for [id ids]
(let [has-focus? (= id @focus-id)]
[:tr "xxx"])))
Bad...
[:tbody
(for [id ids]
(let [has-focus? (= id @focus-id)]
[:tr "xxx"]))]
I wonder if re-frame could report a warning where lazy-seqs are returned from views.
Or if I could pick it up with a spec.
Too tired to make a proper announcement but I just pushed the first preview version of the shadow-cljs npm package.