This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-05
Channels
- # announcements (17)
- # aws (1)
- # babashka (68)
- # beginners (88)
- # calva (85)
- # chlorine-clover (10)
- # cider (5)
- # cljsrn (4)
- # clojure (99)
- # clojure-android (1)
- # clojure-denmark (1)
- # clojure-europe (15)
- # clojure-italy (5)
- # clojure-nl (3)
- # clojure-spec (1)
- # clojure-uk (67)
- # clojurescript (44)
- # core-async (44)
- # cryogen (4)
- # cursive (22)
- # data-science (2)
- # datascript (10)
- # datomic (29)
- # duct (11)
- # editors (2)
- # emacs (2)
- # events (1)
- # fulcro (28)
- # ghostwheel (7)
- # graalvm (8)
- # instaparse (6)
- # java (34)
- # jobs (9)
- # jobs-discuss (71)
- # juxt (12)
- # luminus (3)
- # malli (15)
- # meander (9)
- # nrepl (4)
- # off-topic (44)
- # pathom (13)
- # reagent (22)
- # schema (1)
- # shadow-cljs (39)
- # spacemacs (2)
- # test-check (1)
- # tree-sitter (5)
- # xtdb (5)
- # yada (1)
@alex.sheluchin walkable is an modern alternative to toucan and does support clojurescript https://walkable.gitlab.io/
Thanks, checking it out now. Is Toucan no longer considered "modern"? Just curious.
Frankly Toucan is an Orm, with N+1 problem and inflexibility. It hides database in a global state, so you cant use more than one db throughout your codebase
Js interop question: Assuming you're using shadow-cljs, how do you write an equivalent cljs code?
const db = require('db')
const client = new db.Client({
secret: process.env.DB_SERVER_SECRET
})
probably something like
(ns core.example
(:require [db :refer [Client]]))
(def client (Client. #js {:secret (aget process "env" "DB_SERVER_SECRET")}))
(ns mynamespace
(:require ["db" :refer [Client]]))
(def client (Client. #js {:secret (.. js/process -env -DB_SERVER_SECRET)}))
I think that you can now require npm libraries without quotation marks. Ain’t that right?
(:require ["db" :refer [Client]])
vs (:require [db :refer [Client]])
Yes I think you are right, Clojurescript manages this for several versions however the developer of Shadow-CLJS indicates that the quotes are preferable in order to differentiate the CLJS vs NPM JS libraries. And I'm agree. You confirm @thheller?
Thx for the confirmation.
FWIW I think strings should be used since it makes it clear for the user that this is JS code and not CLJS. it also helps the compiler since it doesn't have to treat every folder in node_modules as a potential namespace. also no ambiguity when using package names that CLJS would encode like some-dash
or @material-ui/foo
etc
Yes I think you are right, Clojurescript manages this for several versions however the developer of Shadow-CLJS indicates that the quotes are preferable in order to differentiate the CLJS vs NPM JS libraries. And I'm agree. You confirm @thheller?
Any clojurescript expert interested in helping out with js interop in borkdude/sci
? https://github.com/borkdude/sci/pull/282
Very small CLJS question for y'all
I have
(defonce booking (atom {:text "Hello!"
:status false}))
(defn booking-swap
[]
(println "updating status")
(println (swap! booking update-in [:status] #(not %)))
(println (get-in booking [:status])))
this is run when I click the booking button. Only problems is (println) on the swap! call returns the correct value. Next (println) for the get-in returns nil
@mbbailey96 booking is an atom, so the last println should be
(println (get-in @booking [:status]))
Thank you! Atom syntax has been unclear to me so far. I was wondering if i needed to deref.
Say @borkdude, I am getting a warning compiling my sci
using project under shadow-cljs
and I am wondering if it is something I am doing wrong, something I should open an issue about, or something I should just ignore because everything seems to actually work. Here is the output, in case you can help me choose a direction:
shadow-cljs - config: /Users/james.elliott/git/bytefield-svg/shadow-cljs.edn cli version: 2.8.90 node: v12.14.1
shadow-cljs - socket connect failed, server process dead?
shadow-cljs - starting via "clojure"
[:lib] Compiling ...
[:lib] Build completed. (80 files, 3 compiled, 1 warnings, 2.43s)
------ WARNING #1 - :undeclared-var --------------------------------------------
Resource: sci/impl/multimethods.cljc:96:3
--------------------------------------------------------------------------------
93 |
94 | (defn multi-fn-add-method-impl
95 | [multifn dispatch-val f]
96 | (#?(:clj .addMethod
---------^----------------------------------------------------------------------
Use of undeclared Var sci.impl.multimethods/clojure
--------------------------------------------------------------------------------
97 | :cljs -add-method) ^clojure.lang.MultiFn multifn dispatch-val f))
98 |
99 | (defn defmethod
100 | "Creates and installs a new method of multimethod associated with dispatch-value. "
--------------------------------------------------------------------------------
Ah, interesting, this is my first deps.edn
project, which should make that much easier to try! I will do a little research and report back. Thanks!
I don't know if shadow-cljs uses the normal CLJS compiler, that has no problem with it
it does use the normal CLJS compiler but has a bit stricter validation on some things ...
Ok, I will move future questions over there. I can report that I see the exact same error using master with git SHA f2424029275dac218396d9d532a8bb757aaac1db
though.
I am unfortunately a complete ClojureScript newbie, so an issue is all I can offer.
I’ll give it a shot. Thanks again!
Well, if checking out my project counts as a repro, we have one today.
(with a walk-through of the build)
this proposal seems pretty amazing: https://github.com/tc39/proposal-record-tuple
@deep-symmetry Can you just try again with f3f3619ec8d217b08a299604adee21c57dc50181
?
Just in time before my meeting! It compiles cleanly. 🎉