This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-18
Channels
- # bangalore-clj (1)
- # beginners (36)
- # boot (119)
- # braid-chat (16)
- # cider (14)
- # cljs-dev (34)
- # cljsrn (7)
- # clojars (9)
- # clojure (91)
- # clojure-austin (1)
- # clojure-bangladesh (1)
- # clojure-dusseldorf (5)
- # clojure-israel (1)
- # clojure-russia (3)
- # clojure-spec (6)
- # clojure-uk (7)
- # clojurescript (11)
- # community-development (1)
- # core-async (5)
- # cursive (6)
- # datomic (11)
- # dirac (12)
- # funcool (24)
- # leiningen (5)
- # luminus (5)
- # off-topic (2)
- # om (69)
- # om-next (16)
- # overtone (4)
- # perun (19)
- # re-frame (23)
- # reagent (38)
- # specter (7)
- # uncomplicate (9)
- # yada (4)
@dnolen: Your talk from ClojuTRE was fantastic! 2 questions from it: - For individual improvements or issues I know that Jira has a lot of info, is there anywhere that has a sort of long term or wider view on the future possibilities of ClojureScript? Sort of the next 5 years in text form or a long term desired roadmap. The no externs and DCE on React in particular are pretty awesome possibilities that I've never thought of before. - Based on your experience and seeing the amount of work and time for ClojureScript to get where it is today, do you have any thoughts on what it would take to target another platform with the same approach (such as Swift or Erlang)? This question is way more related to curiosity than any need to do such a thing, but seeing the amount of work that goes into ClojureCLR for such little reach or usage makes me wonder if the ClojureScript path would make something like that more possible - I really would love to be able to use Clojure everywhere for everything and that's still a bit out of reach.
having issues with deps order under :whitespace mode, due to security restriction of chrome extensions, for content scripts I have to build one static js file, that is why I’m using :whitespace mode during development. Looks like under :whitespace the the sources of deps are concatenated. But this order might not sort deps in the the proper order where goog.provides go before goog.require calls. I ended up with a file where goog.require(“goog.labs.userAgent.util”) is called prior goog.provide(“goog.labs.userAgent.util”) call. Is this a known issue? Quick skimming through JIRA didn’t really give me anything like that.
@darwin FWIW I also don’t recall having seen that in JIRA. Can you repro using latest CLJS?
yes, using the latest, I will try to shrink it for more palatable repo case, definitely hit the problem by relying on some goog-related namespaces
@darwin can you repro it using advanced compilation?
testing it with advanced build right now, but I guess whole goog.require thing will be stripped there
I could maybe give you cljs_deps from :none build, where we will probably see the order :whitespace build
I need a confirmation for a behavior, I noticed that in replumb:
(def a 0)
(defmacro m [] `(println "hey"))
(keys (:defs (get-in @replumb.repl.st [:cljs.analyzer/namespaces 'cljs.user]))) ;;=> (a m)
is it expected? because I remember I had to use the :macros
key to inspect macros' ast before
@richiardiandrea it is if you define a macro at the REPL
because it’s defined in the same compilation stage
ok, so not if I return code from load-fn
right? If so, I have a failing test in replumb that might show a bug (maybe?)
@anmonteiro FYI, under :advanced build all works as expected, there are no goog.require or goog.provide calls (using pseudonames, so I would spot it even after renaming)
@darwin I’ve also spotted subtle issues in :simple
optimizations with cljs.pprint
it seems those compilation modes haven’t been given the same love as :advanced
@richiardiandrea if we’re talking about the same thing, you can also reproduce that behavior in JVM ClojureScript
to recap, if we are talking about stages: if the load-fn
actually returns a defmacro
right there, I should see the macro symbol in :defs
whereas if it uses require-macros
it should appear under :macros
, am I right?
I think quick solution would be to have post-process step for :whitespace/:simple modes and move all goog.provide calls at the beginning of the file, that would solve it
@richiardiandrea the following is in ./script/noderepljs
cljs.user=> (defmacro m [] `(println "key"))
true
cljs.user=> m
#object[cljs$user$m "function cljs$user$m(_AMPERSAND_form,_AMPERSAND_env){
return cljs.core.sequence.call(null,cljs.core.seq.call(null,cljs.core.concat.call(null,cljs.core._conj.call(null,cljs.core.List.EMPTY,new cljs.core.Symbol("cljs.core","println","cljs.core/println",-331834442,null)),cljs.core._conj.call(null,cljs.core.List.EMPTY,"key"))));
}"]
cljs.user=> (m nil nil)
(cljs.core/println "key")
cljs.user=>
I think what you’re saying above is correct, yes
the thing to note is that the macro should be defined in cljs.user$macros
yes that part was clear, but replumb
also tries to fetch things from the ast
directly
https://github.com/Lambda-X/replumb/blob/try-load-fn-file/src/cljs/replumb/ast.cljs#L1
this is cljs_deps table: https://gist.github.com/darwin/f44c2342210605d1e8ec5b2f8f2bab34
I have been using this :whitespace setup for a while without problems. Today I reconfigured it and started using cljs-devtools via :preloads. This is probably the reason, either it triggered the bug or the bug is only related to preloads.
so a question (sorry, long) again for the new things, if I return:
(cb {:lang :clj
:file "fake-source/bar/core.cljs"
:source "(ns bar.core)
(def foo 42)
(def bar 42)
(def baz 42)
(defmacro unless [pred a b]
`(if (not ~pred)
~a
~b))
(defmacro abs [x]
`(unless (neg? ~x)
~x
(- ~x)))
(defmacro sqrt [x]
`(unless (neg? x)
(Math/sqrt x)
(throw
(ex-info \"Real plz\" {}))))"})
and then:
(require '[bar.core :refer [foo bar]])
(require-macros '[bar.core :refer [abs sqrt]])
is this correct?
(keys (get-in <@U07E9BBBN> [:cljs.analyzer/namespaces requirer-ns :use-macros])) ;; => (sqrt abs bar foo)
I am asking because before I use to receive only (sqrt abs)
...I have a test in replumb and it is the only one failing: https://travis-ci.org/Lambda-X/replumb/builds/160882208
so I found the problem in the previous piece of code. By doing:
(require '[bar.core :refer [foo bar]])
(require-macros '[bar.core :refer [abs sqrt]])
and returning the same ns from the load function it looks like I am invoking code in the two different "stages" manually, and foo
and bar
are included in :use-macros
together with abs
and sqrt
.
Instead, with a normal:
(require '[bar.core :refer [foo bar] :require-macros [abs sqrt]])
The :use-macros
key in the ast correctly contains only abs
and sqrt
mmm...still something weird going on...I'll try to figure it out