This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-11
Channels
- # aleph (7)
- # bangalore-clj (11)
- # boot (70)
- # cider (11)
- # cljsjs (3)
- # cljsrn (17)
- # clojure (88)
- # clojure-brasil (8)
- # clojure-dev (17)
- # clojure-greece (1)
- # clojure-italy (6)
- # clojure-poland (8)
- # clojure-russia (2)
- # clojure-spec (44)
- # clojure-uk (32)
- # clojurescript (176)
- # cloverage (2)
- # component (5)
- # cursive (3)
- # datomic (23)
- # defnpodcast (6)
- # dirac (15)
- # emacs (6)
- # garden (19)
- # hoplon (126)
- # leiningen (1)
- # off-topic (3)
- # om (66)
- # onyx (56)
- # re-frame (8)
- # reagent (7)
- # ring-swagger (43)
- # specter (18)
- # untangled (110)
- # vim (3)
- # yada (39)
@jasonjckn AFAIK implements?
is cheaper, it just checks that property with munged protocol name exists, satisfies?
will go and check the real type match, disclaimer: I might be completely wrong
@anmonteiro you were right there was no 'macro meta data'
@iku000888 nothing cljs specific about that - just do it as you would in javascript
@pesterhazy Thanks. The hope was finding a solid choice because I am confused what to do even in JS land (quick googling shows me like infinite alternatives...)
how can I def
/`defn` things by var name (string) instead of symbol? something like (def (symbol "foo") 1)
, but actually working.
@misha: need a macro for that
(defmacro defvar [name init]
`(def ~(symbol name) ~init))
Something like that should work ^
@anmonteiro yeah, trying similar, but I can't define macro in cljs repl, can I?
Macros need to be defined in Clojure
You can require them in the REPL after they've been defined
Yeah if you try to invoke it you'll get wrong arity
It's because of &env
and &form
Macros need to be defined in a separate compilation stage. Which is why they're defined in Clojure
They're expanded in Clojure (in the CLJS analyzer)
I remember that, didn't actually try to write any in cljs repl before. thank you, @anmonteiro
@misha good point about true
being misleading 🙂
sweet, that works, but I suspect, that's not a good production-ready macro, @anmonteiro
Well that was just an example to get you going :-)
Up tou you to make it production ready
is it possible to create a function, with normal defn
, but not namespace it in cljs?
ie, if i have (defn foo [] ...)
in foo.bar
, i don't want to call it from js with foo.bar.foo()
@biscuitpants (set! js/foo foo)
maybe?
I don't think you can defn
straight into the global js namespace
oh shit that worked! thank you so much @martinklepsch. did not know you could do that
@moxaj depends on the build tool you're using
@martinklepsch lein-cljsbuild
@moxaj I think with lein/figwheel/cljsbuild it's recommended to remove the previous build artifacts if something weird starts happening
Is there a way to get a kind of "namespace -> time to compile" map to figure out why incremental compiles take long?
@martinklepsch seems useful for :verbose true
- I think I even considered it at one point
Hi, sorry if this has been discussed already but what does yarn mean for the CLJS (lein/boot) ecosystem?
@johanatan nothing
Unless I'm missing something @johanatan
for people who are using deps from NPM I suspect maybe someone will provide Boot/Lein plugins for Yarn
Is there some alternative to "using deps from NPM"? i.e., if you're doing Node.js development, then it's almost a given that you will need some NPM modules (less so on frontend but, even there, there is that risk)
many people using ClojureScript aren’t using deps from NPM, if they are they building a single foreign dep
Been off twitter for the day and there's a new big thing in JS 😄
@mfikes re :const
var failing with :parallel-build
on .. One of my source files is compiled twice. It fails the second time. This is me right now: http://i.imgur.com/Br00TCn.gif
@moxaj The compiler takes the namespaces in all of your source files, forms a dependency partial order from them, and then a topological sort of that, and uses that for parallel compilation. So, it should compile each file once and only once.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply
@pvinis https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply
@moxaj If all the ns
forms are correct in all namespaces in your project, then yes you should get a warning if a circular dependency exists.
(.apply (.. ReactNative -Alert -alert) nil (clj->js (cons title rest))))
did it like that
@pvinis #js [title rest]
should work, that’s all your code is doing except less efficiently
btw, awesome that you are coming to vienna later this month. i will be in the meetup too
@johanatan that’s not valid
@johanatan nothing to do with escaping
you should be conservative with cljs->js
, the perf hit is huge as your data structure increases in size
@dnolen trying to insert printlns-s
into cljs.compiler/compile-root
, but apparently they have no effect. spit
doesn't work either. Happen to know why?
@dnolen already using that. And the reason - cljs.js-deps/dependency-order already receives the same namespace twice (for some reason, println
works there), so I'm trying to track the input backwards
@moxaj the thing in cljs.compiler
is that *out*
is probably bound to the file your outputting
if you want to print something out you probably need to bind it to *err*
first
@anmonteiro i'll give it a try, thanks!
that said, I don’t know what you’re trying to do
so you should probably listen to David first
@dnolen contains mikron.common.math
twice - once with a java.io.File
source, once with a java.net.URL
source, strange
@moxaj well not completely unexpected to me at least - you’re compiling a directory of sources and then we also need to resolve stuff on the classpath
@moxaj it will be useful if you can minimize this issue into a simple project that someone else can run
I have been thinking of building program to stream my media, mini-plex basically, as a learning exercise. Is there any libraries that you recommend for streaming local video and/or audio?
Is that ok when learning Clojure(Script) your code is more like procedural, rather than functional?
I mean it feels like so
@yury.solovyov: I think so, that's how I've learned / continue to learn - once it's working it's pretty easy and informative to refactor into a more idiomatic style.
A while ago I looked for a way to make parameter optional, and I even found a similar question on SO, but it turned out that you just use multiple arity
@yury.solovyov I’m not sure what you are asking but if you’re trying to import JS idioms around optional parameters, then yes I would avoid that
Nah, I just share my UXs
@yury.solovyov if the question is just more general - then yeah, picking up a more functional style takes some time
@dnolen I believe I have figured it out. in cljs.closure/add-dependency-sources
, inputs
has source files as java.io.File
s. When we add the dependencies, those are java.net.URL
s. So even though inputs
is a set, many elements will be duplicated because they differ on :source-file
. Casting those java.io.File
s to java.net.URL
s eliminated the error. Now to make a repro ..
Hi all, sorry, new around here. IS this an appropriate forum to ask clojurescript questions? I'm new to the community and having some issues.
@thomas.williams you’ve found the place 🙂
I was wondering, is there more extensive documentation for project.clj than the sample one provided on the clojurescript site? I am looking at some example project.clj files that use stuff like :
:npm {:dependencies [[react-d3-components "^0.6.0"]
[react-youtube "^5.0.0"]
[webpack "^1.12.9"]]
:package
{:scripts
{:postinstall "npm run dev && npm run min"
:dev "webpack --output-filename webpack-deps.js"
:min "webpack --optimize-minimize --output-filename webpack-deps.min.js"}}}
I cannot find any documentation on how this :npm field works. Or exactly what it does.
@thomas.williams I’m assuming that requires this Lein plugin https://github.com/RyanMcG/lein-npm
@thomas.williams but more importantly, can you be more clear what you are asking about?
Is there a good way to find these plugins?
I am just trying to learn how to figure out how things work in this file 🙂
resources that are good for research
and documentation
So, for example, how did you find that plugin?
there’s a lot of stuff still just on the wiki https://github.com/clojure/clojurescript/wiki
@thomas.williams: Anecdotally, I've been using CLJS for quite a while and have never needed to use any plugins - there's a ton of stuff available within the CLJS world, so unless you have the need to use a particular plugin it's probably safe to ignore that part of project.clj
and work on other things for a while.
@juhoteperi Are you by any chance the person who created the pouchdb-find package?
as part of Dirac documentation effort I wrote this article on REPLs: https://github.com/binaryage/dirac/blob/master/docs/about-repls.md
I’m sure I’m doing something stupid, but in https://github.com/arohner/om-html/blob/master/src/om_html/html.cljc, when I try to call html/html, I’m seeing WARNING: Wrong number of args (1) passed to om-html.html/html at line 6