This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-27
Channels
- # arachne (1)
- # beginners (31)
- # boot (84)
- # cider (9)
- # clara (2)
- # cljs-dev (102)
- # cljsrn (20)
- # clojure (254)
- # clojure-belgium (1)
- # clojure-dusseldorf (17)
- # clojure-greece (7)
- # clojure-italy (6)
- # clojure-russia (2)
- # clojure-spec (8)
- # clojure-uk (9)
- # clojurescript (93)
- # component (4)
- # copenhagen-clojurians (1)
- # cursive (24)
- # datomic (22)
- # editors (1)
- # emacs (8)
- # garden (2)
- # hoplon (357)
- # lein-figwheel (1)
- # leiningen (4)
- # luminus (27)
- # mount (13)
- # off-topic (7)
- # om (71)
- # onyx (35)
- # planck (3)
- # re-frame (53)
- # reagent (35)
- # ring-swagger (24)
- # specter (10)
- # sql (6)
- # untangled (47)
- # vim (157)
@dnolen Don’t mean to rush you at all, just wanted to put this patch on your radar in case it’s not there yet Really excited for its possibilities http://dev.clojure.org/jira/browse/CLJS-1782
@anmonteiro sorry I need to review that one more closely will probably have to wait to Friday but I will put it at the front of my queue
that works great, thanks!
@anmonteiro Can you elaborate about why currently when a namespace requires its own macros, there is an infinite loop?
@viebel have you tried the minimal example in that issue in e.g. Planck?
Yeah. I mean: what is the explanation for that behaviour?
the problem is that if you have the foo.core
namespace, and you require its own macros, the foo.core$macros
namespace will also try to require its own macros and so on
that results in an infinite loop
but there’s no such thing as a $macros
namespace requiring its own macros, which is what my patch addresses
Oh. I see: in boostraped cljs, the reader conditional interprets #?(:cljs
as true
@viebel yeah, that’s the problem
macros are not evaluated in Clojure
because, oh well, self-hosted ¯\(ツ)/¯
@anmonteiro I hope your patch will be merge soon. It will make much easier to port clojurescript libs
it will
this problem doesn’t happen when you have e.g. a .cljs
file and a .cljc
file however
Is there a particular lib that might be supported with your patch - without any code modification?
it’s really specific to the case where you have a single .cljc
file that you want to share between Clojure/ClojureScript/Self-hosted
which becomes amazing.
@viebel yes, Om Next
after the server-side rendering patch it runs into this issue
I tested it with my patch and it works great
WONDERFUL:sunglasses:👏
which is a rather cool sign
I remember that a couple of months ago, I tried to load https://github.com/tonsky/datascript/ in KLIPSE and I had the “infinite loop” problem
Did u try it?
well, let’s give it a try!
mind putting together a snippet?
IDK, a snippet that works in JVM CLJS
that I can try locally with my patch in self-hosted
e.g. which namespace to load etc
OK. Will send u one soon
I have never used datascript extensively
@viebel nah doesn’t work
because all macros are under :clj
conditionals
it’ll require some changes
Why is it a problem that the macros are under :clj
conditionals?
because bootstrapped CLJS won’t read :clj
conditionals
FWIW, in klipse (without your patch) the file arrays.cljc
loads itself in an infinite loop. See: http://app.klipse.tech/?cljs_in=(ns%20my.script%0A%20%20(%3Arequire%20%5Bdatascript.core%20%3Aas%20d%5D))%0A&external-libs=%5Bhttps%3A%2F%2Fraw.githubusercontent.com%2Ftonsky%2Fdatascript%2Fmaster%2Fsrc%2F%5D
there’s no :clj
reader in bootstrapped cljs AFAIK
You mean that the codes under :clj
will never get evaluated - in bootstraped cljs?
not even read
@dnolen there’s no cljs.core/num
, is this intended or an oversight?
only meant for parity with Clojure
Coerce to Number
I also wasn’t aware it existed until just now
I don’t know if it’s supposed to exist or not, but given that unchecked-int
exists, I asked
1 sec
(defn num
"Coerce to Number"
{:tag Number
:inline (fn [x] `(. clojure.lang.Numbers (num ~x)))
:added "1.0"}
[x] (. clojure.lang.Numbers (num x)))
not easily portable
maybe something like (js/Number x)
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L1404
it just casts the argument to java.lang.Number
@dnolen I agree, my asking was only related to API parity with Clojure
gotcha
what I suggested earlier (js/Number x)
wouldn’t really mimic the Clojure version anyway
btw, after some more thought, yes I do like the loading the same file for macros patch idea
boot.user=> (num "3.3")
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
cljs.user=> (js/Number "3.3")
3.3
@dnolen awesome, glad to hear
New Closure compiler version, this one again breaks APIs compared to previous version 😄
(or maybe I just have a problem the new dep)
It was just a problem with Intellij/Cursive not seeing the new dep
@juhoteperi have you made progress with the upgrade to the new GCC?
Haven't had time to look at this for some time, looking now
cool, have fun!
Phew, finally some progress
Looks like the root Node used to call toSource is called with the original (?) node instead of the node in transpiled AST
calling toSource version of closure compiler without node param returns the processed code
but it returns the code for all nodes (e.g. all different files)
Looks like I got the correct processed source written to disk now
for some reason the Closure module information is not yet read from the processed file
Oh, it's because js-deps/load-library
is memoized globally
Probably works normally, but when testing from repl it remembers the old broken file
awesome!
https://github.com/Deraen/clojurescript/blob/cljs-1762/src/main/clojure/cljs/closure.clj#L1528
quite hacky still, as convert-js-module is called for each ijs, instead of once per module-type
Why doesn't transit-cljs extend its types to be IComparable
? The issue I'm running into is that DataScript is attempting to compare a bigints and is blowing up. (I didn't see a Transit channel so forgive me if this isn't an appropriate topic.)
@domkm no particular reason though it seems to me you can fix one yourself, the right place to bring this up is the GitHub transit-cljs repo
Okay, thanks @dnolen. I was mistakenly under the impression that those were read-only repos. I'll open an issue.
https://github.com/clojure/clojurescript/compare/master...Deraen:cljs-1762-2 & attached new patch at the issue
Contains still several FIXME notes which need to be addressed
I tried to load React npm package and got 250 lines of ERROR: JSC_COMMONJS_MODULE_LOAD_ERROR. Failed to load module "react/lib/ReactTransitionGroup" at cljsjs.npm/react-addons-transition-group/index.js line 1 : 17
and 250 of WARNING: JSC_BAD_JSDOC_ANNOTATION. Parse error. illegal use of unknown JSDoc tag "providesModule"; ignoring it at cljsjs.npm/react/lib/AutoFocusUtils.js line 9 : 3
But old Closure compiler just threw NPE so this is lot more promising 🙂