This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-05
Channels
- # 100-days-of-code (1)
- # announcements (7)
- # beginners (84)
- # boot (1)
- # cider (22)
- # cljdoc (14)
- # cljs-dev (45)
- # cljsrn (6)
- # clojure (65)
- # clojure-conj (7)
- # clojure-finland (1)
- # clojure-italy (7)
- # clojure-nl (2)
- # clojure-serbia (1)
- # clojure-uk (111)
- # clojurescript (58)
- # cursive (8)
- # datomic (68)
- # duct (1)
- # emacs (33)
- # figwheel (3)
- # figwheel-main (9)
- # fulcro (33)
- # graphql (1)
- # juxt (30)
- # kaocha (4)
- # off-topic (22)
- # pathom (47)
- # pedestal (4)
- # planck (6)
- # re-frame (1)
- # reagent (1)
- # reitit (13)
- # shadow-cljs (49)
- # spacemacs (7)
- # sql (6)
- # tools-deps (60)
I'm porting an script to cljs
and I see that (map int "abc")
returns non-sense in cljs
(expected: (97 98 99)
actual: (0 0 0)
)
It should be a ticket on jira?
(defn int
"Coerce to int by stripping decimal places."
[x]
(cond
(char? x) (.charCodeAt x 0))
:else (bit-or x 0))
fwiw, the cljs implementation:
(defn int
"Coerce to int by stripping decimal places."
[x]
(bit-or x 0))
Definitely looks different 🙂Hi guys, how would you approach error tracking software like http://sentry.io in your clojurescript (browser) project?
Question / bug, not sure:
;; run with:
;; clj -Srepro -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.439"} org.clojure/test.check {:mvn/version "RELEASE"}}}' -m cljs.main -re node -i node_exit.cljs
(ns node-exit
(:require
[clojure.test.check]
[clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as stest]
[clojure.test :as t]
))
(defmethod cljs.test/report [::t/default :end-run-tests] [m]
(if-not (cljs.test/successful? m)
(.exit js/process 1)
(.exit js/process 0)))
(t/deftest some-test
(t/is false))
(t/run-tests)
(println "done, exiting")
What’s the proper way of exiting the process with the correct exit code here? Now the process hangs. It doesn’t hang without the defmethod.@borkdude you probably just want to compile the node script and then run it separately via node
. if you let cljs.main run it you'll just kill the node process its managing but the JVM process will stay alive
@thheller shouldn’t there be a supported way for returning the correct exit code in a script ran by -i
?
no idea what cljs.main
does or should do. it might make sense yes but given that its pretty much only a node thing its probably best to just separate compiling and running
@ales.najmann we just bundle the sentry js client (raven.js iirc) in our cljs app
hey guys, does anybody know how to require node.js modules with the @
character through the ns :require
form; like
(ns hive.components.foreigns.expo
(:require [expo :as Expo]
["@expo/vector-icon"s :as VectorIcons] ;; <-- this fails :(
[hive.foreigns :as fl]))
Nope, but I do have target node js. I'm not sure if Clojure does automatically scan the npm node modules though.
You don't necessarily have to change your cljs version, just explicitly set it to what you want. I think I read the announcement on #cljs-dev
its supposed to work that way but :npm-deps
has issues with @
I believe. Not sure if that was fixed or still ongoing
@mfikes cool! I’m using the regular compile now that @thheller suggested in speculative
Can't take value of macro ... in a .cljc file http://ix.io/1r3N
@borkdude yeah that would be useful if I would be unquoting something, like returning a list from the macro that contains some symbols that I need to mask with auto-gen-sym (`foo#`)
no it's not cljs code, that's why the macro is enclosed in reader conditional, but it can be used from both clj and cljs during compile time
FWIW, this compiles in a .cljc file for me:
#?(:clj
(defmacro list-posts []
(vec
(for [f [1 2 3]
:when (even? f)]
f))))
(def posts
(list-posts))
(ns dre.foo
(:require
#?(:clj [net.cgrand.macrovich :as macros]))
#?(:cljs
(:require-macros
[net.cgrand.macrovich :as macros]
[dre.foo :refer [list-posts]])))
#?(:clj
(defmacro list-posts []
(vec
(for [f# [1 2 3]
:when (even? f#)]
f#))))
(def posts
(list-posts))
without macrovich you would probably need an extra .cljs file that imports the macro from the .cljc file
@borkdude awesome! it actually works without macrovich too, I just need that #?(:cljs (:require-macros...
form
I tried something similar before, but I did reader conditional inside (:require
form, with :refer-macros
, and that didn't work
when given a fn, is it possible to look up the metadata that is associated with it in a defn
without a macro?