This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aleph (1)
- # announcements (2)
- # beginners (20)
- # calva (44)
- # cider (60)
- # clj-kondo (6)
- # clojure (27)
- # clojure-dev (2)
- # clojure-europe (8)
- # clojure-italy (18)
- # clojure-mexico (5)
- # clojure-nl (61)
- # clojure-spec (12)
- # clojure-uk (101)
- # clojurescript (82)
- # cursive (2)
- # data-science (21)
- # datomic (24)
- # fulcro (19)
- # graalvm (5)
- # hoplon (11)
- # jobs-discuss (35)
- # juxt (7)
- # keechma (6)
- # off-topic (21)
- # pedestal (5)
- # planck (2)
- # qa (43)
- # re-frame (3)
- # reagent (7)
- # reitit (4)
- # rewrite-clj (12)
- # sql (10)
- # testing (4)
- # tools-deps (6)
- # vim (23)
- # xtdb (3)
I’m in the middle of (re?)inventing the wheel myself
@vnctaing it's not really reinventing the wheel, in my experience no library for managing forms fits particular requirements, I've stopped fighting them and just doing it from scratch every time.
there are some patterns that have been emerging for me, for example, I put the whole state of the for in the global db, so the
path interceptor of re-frame has proven very useful
⚠️ also, writing an “assoc-in”-like handler for storing state and then allowing the field to “know” where to store its value is a very bad idea
I’m still trying to get the code to a boilerplate-free state, but not quite there yet
I have a
cljc file with this import
(:require [clojure.core.async :refer [go-loop <! promise-chan timeout]]), and it seems to work in clojurescript too. I find that weird. I thought I had to use
cljs.core.async instead of
clojure.core.async and that I had to specify
Problem is that when I google how to write and use macros in
cljc code I get tons of posts from ages ago which use old ways of cljs.
@roklenarcic AFAIK the cljs compiler internally renames the http://clojure.xxx to http://cljc.xxx so you can use the same source for both clj and cljs.
@roklenarcic See https://clojurescript.org/guides/ns-forms and in particular these sections
clojure Namespace Aliasing
- Implicit Sugar
yeah I saw that. I have a
clj file for same namespace. The clj file contains a macro that is used in cljc. In cljc file I have this:
When I try to compile cljs I get this:
(ns myproject.i18n #?(:cljs (:require-macros [myproject.i18n]))) ; my-macro is defined in clj file (def my-val (my-macro))
WARNING: Can't take value of macro myproject.i18n/my-macro at line 7 /Users/roklenarcic/clojure-projects/myproject/src/cljc/myproject/i18n.cljc
And I read that page and it says that this is valid:
(ns foo.core (:require-macros foo.core))
Hello, I'm wondering what is the state-of-art ClojureScript stack? It seems that React + ClojureScript is the most popular, is that correct?
Yes, though there are numerous React wrappers
Reagent, which also has higher level Re-Frame, then Om, Om.next, Fulcro, Rum, and others
I want to create a seq on a JS object (it’s guaranteed immutable by convention). any prior art?
Hey! Does anyone have any tip on which Material UI package to use when using Reagent?
@lilactown mmm, maybe something like
(extend-type object ISeqable (-seq [b] (let [gets (js-keys b) vs (mapv (partial aget b) gets)] (seq (zipmap gets vs)))))
Just make a
obj->map thing with
reify - it's useful and educational to implement all the protocols
The reason I'm trying to do this is because I want to give a consumer the ability to interact with the objects just like a map, but that I need to turn it back into into an object
but if you make a thing that doesn't support, i.e. throws or something - it's not a lot of work
I've only started thinking about assoc , and that seems doable without conversion as long as I rely on only strings or keywords as keys. Where does it fall over?
My current strategy is to create a wrapper type that simply proxies to the JS object. Then when I need the JS object itself, I can unwrap it
@lilactown there's a thing called
ObjMap deprecated but it's not going to be removed that does all this stuff already
I only need to do all of this shallowly. So my thinking is that copy on right shouldn't be too bad
@ahmed1hsn can you be more specific? it's not clear what you mean
@dnolen This is Hoplon lib using JQuery for de-referencing event values inside event handler functions. It implements IDeref in JQuery, I don't want to use JQuery so want to implement it in Google Closure Library. https://github.com/hoplon/demos/blob/master/inputs/src/index.cljs.hl#L38
@ahmed1hsn deref on what?
ok, I'm trying to implement similar thing in GCL.
The deref here is just a bit of sugar for getting at the value of the event. It's not necessary - you can use property access.
In cljs, I like to think of deref as a 'step guard' of sorts, for demarcating pure stuff from impure stuff
What else would one use it for in js land? unifying interfaces across futures, promises, eventually available things?
right I'm just saying stating a general related point because you can't achieve unification in a meaningful way