This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-15
Channels
- # 100-days-of-code (3)
- # announcements (14)
- # beginners (100)
- # calva (20)
- # cider (50)
- # cljdoc (29)
- # cljs-dev (6)
- # clojure (78)
- # clojure-europe (1)
- # clojure-italy (8)
- # clojure-losangeles (1)
- # clojure-nl (11)
- # clojure-uk (108)
- # clojurescript (23)
- # code-reviews (5)
- # cursive (7)
- # datomic (11)
- # devops (1)
- # editors (1)
- # figwheel-main (65)
- # fulcro (114)
- # hoplon (31)
- # hyperfiddle (1)
- # juxt (4)
- # lein-figwheel (2)
- # nrepl (13)
- # off-topic (72)
- # re-frame (35)
- # reagent (9)
- # shadow-cljs (42)
- # spacemacs (2)
- # specter (5)
- # tools-deps (60)
- # yada (2)
@idiomancy you can disable hot reloading in figwheel
like, I want it to swap out the JS, I just want to have control over when it happens
That's what I tend to do, especially for "library-ish" parts of the codebase (turn off Figwheel hot loading and then use (require ... :reload)
or even just send forms to the REPL.)
This is useful when you are working with Spec, and have an alias set up in the REPL via
(require '[clojure.spec.test.alpha :as st])
By temporarily turning off Figwheel, this alias won't be removed on each save.How would you prefer to validate forms with spec? 1)
(s/def ::form (s/and (s/keys :req-un [::email ::password]
:opt-un [::password-repeat])
::spec-password-repeat))
+: you can simple provide ::form
to library vlidator
-: to validate form library have to validate whole form each time, even during typing in 1 input
2)
{:email [::email]
:password [::password]
:password-repeat [::password-repeat ?password-repeat]}
+: validate only input which changed, don’t have to validate whole ::form
each time
-: duplicate spec but in different form to let library recognise what check for what form
Why this issue?
(s/def ::form (s/and (s/keys :req-un [::email ::password]
:opt-un [::password-repeat])
::spec-password-repeat))
There is no way to read from spec keys and assign them to specific inputs. At least I don’t see such way.https://clojurians.slack.com/archives/C03S1KBA2/p1539614458000100?thread_ts=1539611496.000100&cid=C03S1KBA2 Oh actually it is a way to read keywords
But it is still an issue with ::spec-password-repeat
and similar things. It will be buggy probably.
How come cljs-main does not like a reg-ex with \/
in it, when Lumo does?
$ clj -Sdeps '{:deps {org.clojurescript {:git/url "" :sha "6eedd0a08c49f7b0d4dcb30977b2fb38c90577bd"}}}' -m cljs.main -re node -e '(re-matches #"^.+\/.+" "foo/bar")'
Exception in thread "main" clojure.lang.ExceptionInfo: repl:1
cljs.core.pr_str.call(null,cljs.core.re_matches.call(null,/^.+\\/.+/,"foo/bar"));
^
SyntaxError: Unexpected token +
at createScript (vm.js:80:10)
vs
$ lumo -e '(re-matches #"^.+\/.+" "foo/bar")'
"foo/bar"