<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged clojurescript</title>
<link>https://ask.clojure.org/index.php/tag/clojurescript</link>
<description></description>
<item>
<title>Missing protocol error will hang on infinite `(range)` input in ClojureScript but not Clojure</title>
<link>https://ask.clojure.org/index.php/15026/missing-protocol-error-infinite-range-clojurescript-clojure</link>
<description>&lt;p&gt;functions like &lt;code&gt;transient&lt;/code&gt;, &lt;code&gt;assoc&lt;/code&gt;, etc  will throw helpful missing-protocol error when receiving invalid input but it will hang if it receives infinite &lt;code&gt;(range)&lt;/code&gt;.&lt;br&gt;
this is related to issue below&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/14578/even-range-hangs?show=14578#q14578&quot;&gt;https://ask.clojure.org/index.php/14578/even-range-hangs?show=14578#q14578&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;however, missing-protocol only hang in clojurescript but not clojure so I am wondering if this difference is intended.&lt;/p&gt;
&lt;p&gt;example calls that should throws&lt;br&gt;
- &lt;code&gt;(transient (range))&lt;/code&gt;&lt;br&gt;
- &lt;code&gt;(assoc (range) :a 1)&lt;/code&gt;&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15026/missing-protocol-error-infinite-range-clojurescript-clojure</guid>
<pubDate>Fri, 03 Apr 2026 11:16:47 +0000</pubDate>
</item>
<item>
<title>TypedArrays don't implement ICounted in cljs</title>
<link>https://ask.clojure.org/index.php/14919/typedarrays-dont-implement-icounted-in-cljs</link>
<description>&lt;p&gt;I just discovered that JS TypedArrays (&lt;code&gt;Uint8Array&lt;/code&gt; et al) do not implement &lt;code&gt;ICounted&lt;/code&gt; out of the box, even though it's trivial to make them do so. As a result &lt;code&gt;count&lt;/code&gt; doesn't work on them; this is in contrast to Clojure where &lt;code&gt;count&lt;/code&gt; works on arrays of primitives. Can/should this be added, or is the current behaviour intended?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(count (js/Uint8Array. [1 2 3]))
;; Execution error (Error) at (&amp;lt;cljs repl&amp;gt;:1).
;; No protocol method ICounted.-count defined for type object: 1,2,3
;=&amp;gt; :repl/exception!

(extend-protocol ICounted
 js/Uint8Array 
 (-count [this] (alength this)))
;=&amp;gt; #object [Function]

(count (js/Uint8Array. [1 2 3]))
;=&amp;gt; 3
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14919/typedarrays-dont-implement-icounted-in-cljs</guid>
<pubDate>Thu, 05 Feb 2026 12:37:54 +0000</pubDate>
</item>
<item>
<title>bit-count in cljs but not clj</title>
<link>https://ask.clojure.org/index.php/14917/bit-count-in-cljs-but-not-clj</link>
<description>&lt;p&gt;The &lt;code&gt;bit-count&lt;/code&gt; function ships as part of CLJS but not CLJ, which means I end up using a reader conditional to use &lt;code&gt;Long/bitCount&lt;/code&gt; on the JVM side when I write cljc files. It would be nice if I could just use &lt;code&gt;bit-count&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;(I chose &quot;compiler&quot; for category because there's no option for &quot;standard library&quot;) &lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14917/bit-count-in-cljs-but-not-clj</guid>
<pubDate>Fri, 30 Jan 2026 09:21:40 +0000</pubDate>
</item>
<item>
<title>Literals for Unicode code points (and perhaps also sequences thereof)</title>
<link>https://ask.clojure.org/index.php/14875/literals-unicode-code-points-perhaps-also-sequences-thereof</link>
<description>&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.oracle.com/technical-resources/articles/javase/supplementary.html&quot;&gt;For historical reasons&lt;/a&gt; the JVM type system's support for Unicode code points is poor, and while this is usually invisible to the developer it becomes a hassle when String literals containing non-Latin1 code points are used in code.  It also becomes particularly problematic when cross-platform (cljc) code is attempting to do this, since other platforms may not share this historical oddity so solutions that &quot;work&quot; in ClojureJVM may break in other dialects.&lt;/p&gt;
&lt;p&gt;For example, the &lt;a rel=&quot;nofollow&quot; href=&quot;https://emojipedia.org/transgender-flag#technical&quot;&gt;transgender flag emoji&lt;/a&gt; (a single grapheme cluster that happens to be defined by 5 Unicode code points) cannot easily be constructed at the REPL or in a source file without detailed knowledge of the JVM's history (and associated knowledge of UTF-16, an increasingly obsolete character encoding).&lt;/p&gt;
&lt;p&gt;Using the documented code points for this grapheme cluster with the JVM's Unicode escaping mechanism does &lt;em&gt;not&lt;/em&gt; give the expected outcome:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://i.ibb.co/gM2XsWBG/Screenshot-2026-01-12-at-11-13-38-AM.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;The correct, but unintuitive solution is to remember that the JVM does not directly support Unicode code points in the supplemental planes, and then to translate the supplemental code point &lt;code&gt;U+1F3F3&lt;/code&gt; into its UTF-16 code unit / surrogate pair representation:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://i.ibb.co/60b1ZLXh/Screenshot-2026-01-12-at-11-15-56-AM.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Note: I had to use screenshots for this, since ask.clojure doesn't appear to support Unicode supplemental code points properly either...&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Question/request/proposal&lt;/strong&gt;&lt;br&gt;
Clojure can sidestep this issue in a purely accretive manner, providing better consistency across the JVM and other runtimes, by adding direct support for Unicode literals.&lt;/p&gt;
&lt;p&gt;This would involve adding a new literal syntax that represents a single Unicode code point, and perhaps also a new literal syntax that represents a sequence of Unicode code points (perhaps supporting not only the novel Unicode code point literal, but also the existing Character and String literals).  Both of these new literals would produce a standard JVM (or JavaScript, or ...) String object, in whatever native encoding those objects employ on their respective platforms - after such literals are read, it's all just the extant String data type - there is no runtime impact.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;An &lt;em&gt;example&lt;/em&gt; literal syntax&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;While I am not proposing a specific syntax for these new literals here (though such a task is a necessary step), for illustrative purposes here is an example of what these literals &lt;em&gt;might&lt;/em&gt; approximately look like:&lt;/p&gt;
&lt;p&gt;Single Unicode code point literals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;#U+0061&lt;/code&gt;: produces a String containing the Latin letter a: &lt;code&gt;&quot;a&quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+1F921&lt;/code&gt;: produces a String containing &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.compart.com/en/unicode/U+1F921&quot;&gt;the clown emoji&lt;/a&gt; (which ask.clojure cannot display)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sequences of Unicode code point literals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;#U+[U+0061 U+0020 U+1F921]&lt;/code&gt;: produces the 3 grapheme cluster String: &lt;code&gt;&quot;a &amp;lt;clown emoji&amp;gt;&quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+[&quot;a &quot; U+1F921]&lt;/code&gt;: produces the same String, but demonstrates why it may be useful to support a mix of literals within the sequence (for readability)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+[\a \space U+1F921]&lt;/code&gt;: ditto&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+[U+1F3F3 U+FE0F U+200D U+26A7 U+FE0F]&lt;/code&gt;: produces a String containing a single grapheme cluster (the transgender flag emoji)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This final example is an ideal test case, since the transgender flag emoji is a single Unicode grapheme cluster, defined by 5 Unicode code points, but on the JVM (for the historical reason listed originally) is made up of &lt;em&gt;6&lt;/em&gt; Characters.&lt;/p&gt;
&lt;p&gt;Note that the sequence literal may not be necessary, since &lt;code&gt;str&lt;/code&gt; could be used with the single code point literal syntax; e.g. &lt;code&gt;(str #U+1F3F3 #U+FE0F #U+200D #U+26A7 #U+FE0F)&lt;/code&gt;.  Whether shifting the cost of string concatenation from read-time to runtime matters or not is another topic worthy of deeper consideration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Other notes&lt;/strong&gt;&lt;br&gt;
Orthogonal to this proposal (at least from a Clojure core perspective; from a user perspective they're closely related), it would also be useful if Clojure core (perhaps in the &lt;code&gt;clojure.string&lt;/code&gt; namespace) had functions to turn Strings into sequences of code points (as integers) and vice versa.  Both the JVM and JavaScript provide native APIs for doing this (and presumably other platforms do too), but providing these as standard functions in Clojure core (similar to what was done with &lt;code&gt;parse-long&lt;/code&gt;, &lt;code&gt;parse-double&lt;/code&gt;, and &lt;code&gt;parse-boolean&lt;/code&gt; in Clojure v1.11) has value and is also purely accretive.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14875/literals-unicode-code-points-perhaps-also-sequences-thereof</guid>
<pubDate>Mon, 12 Jan 2026 20:02:41 +0000</pubDate>
</item>
<item>
<title>ClojureScript :preloads doesn't work with just cljs.main --repl</title>
<link>https://ask.clojure.org/index.php/14863/clojurescript-preloads-doesnt-work-with-just-cljs-main-repl</link>
<description>&lt;p&gt;Running cljs.main with just &lt;code&gt;--repl&lt;/code&gt; doesn't preload whatever is on :preloads.&lt;/p&gt;
&lt;p&gt;Given that the quickest way of trying ClojureScript is by running a command like :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version &quot;1.12.134&quot;}}}}' -M -m cljs.main --repl
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it would be great (and I think expected) to be able to run a repl with some dev tooling, like :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version &quot;1.12.134&quot;} binaryage/devtools {:mvn/version &quot;1.0.7&quot;}}}}' -M -m cljs.main -co '{:preloads [devtools.preload]}' --repl
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but it doesn't work.&lt;/p&gt;
&lt;p&gt;It reads the file (it complains if you misspell the preload namespace) but then nothing gets loaded.&lt;/p&gt;
&lt;p&gt;The problem seems to be related to ClojureScript not compiling the preload namespace when you run with just --repl&lt;/p&gt;
&lt;p&gt;If you create a small single file project (like on the start guide) and then do :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version &quot;1.12.134&quot;} binaryage/devtools {:mvn/version &quot;1.0.7&quot;}}}}' -M -m cljs.main -co '{:preloads [devtools.preload]}' --compile hello-world.core --repl
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it works.&lt;br&gt;
After the compile generates the &lt;code&gt;out&lt;/code&gt; folder you can run just with &lt;code&gt;--repl&lt;/code&gt; and the preload will work.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14863/clojurescript-preloads-doesnt-work-with-just-cljs-main-repl</guid>
<pubDate>Wed, 24 Dec 2025 15:13:56 +0000</pubDate>
</item>
<item>
<title>`(max &quot;x&quot; &quot;y&quot;)` used to return &quot;y&quot;, now it returns &quot;x&quot;</title>
<link>https://ask.clojure.org/index.php/14847/max-x-y-used-to-return-y-now-it-returns-x</link>
<description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;With cljs 1.12.42:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cljs.user=&amp;gt; (max &quot;x&quot; &quot;y&quot;)
&quot;y&quot;
cljs.user=&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With cljs 1.12.134:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cljs.user=&amp;gt; (max &quot;x&quot; &quot;y&quot;)
&quot;x&quot;
cljs.user=&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Probably related to &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJS-3425&quot;&gt;CLJS-3425&lt;/a&gt; and &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojurescript/commit/274701280de787b598071460cdac0a3709a5bc11&quot;&gt;this commit&lt;/a&gt; which added &lt;code&gt;NaN&lt;/code&gt; checks:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn ^number max
  &quot;Returns the greatest of the nums.&quot;
  ([x] x)
  ([x y]
   (cond
     (NaN? x) x
     (NaN? y) y
     (&amp;gt; x y) x
     :else y))
  ([x y &amp;amp; more]
   (reduce max (cljs.core/max x y) more)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cljs.user=&amp;gt; (NaN? &quot;x&quot;)
true
cljs.user=&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Hence the result.&lt;/p&gt;
&lt;p&gt;Not sure what the expected result should be since min/max are only supposed to work with numbers but current behavior is surprising.&lt;/p&gt;
&lt;p&gt;See also: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/jank-lang/clojure-test-suite/pull/839&quot;&gt;https://github.com/jank-lang/clojure-test-suite/pull/839&lt;/a&gt;.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14847/max-x-y-used-to-return-y-now-it-returns-x</guid>
<pubDate>Mon, 22 Dec 2025 13:45:04 +0000</pubDate>
</item>
<item>
<title>How does `parents` work for JavaScript inheritance?</title>
<link>https://ask.clojure.org/index.php/14764/how-does-parents-work-for-javascript-inheritance</link>
<description>&lt;p&gt;Hello &lt;/p&gt;
&lt;p&gt;In Clojure, I can do:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(parents String)
; #{java.lang.constant.ConstantDesc java.lang.Object java.lang.CharSequence java.io.Serializable java.lang.constant.Constable java.lang.Comparable}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But in ClojureScript:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(parents js/String)
; nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;ClojureScript's &lt;code&gt;parents&lt;/code&gt; doc does mention &quot;JavaScript type inheritance&quot;: &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Returns the immediate parents of tag, &lt;strong&gt;either via a JavaScript type&lt;br&gt;
inheritance relationship&lt;/strong&gt; or a relationship established via derive. h&lt;br&gt;
must be a hierarchy obtained from make-hierarchy, if not supplied&lt;br&gt;
defaults to the global hierarchy&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Is there something wrong with the syntax I used?&lt;/p&gt;
&lt;p&gt;Is &lt;code&gt;parents&lt;/code&gt; really supposed to work with JavaScript inheritance on ClojureScript?&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14764/how-does-parents-work-for-javascript-inheritance</guid>
<pubDate>Sun, 23 Nov 2025 14:28:23 +0000</pubDate>
</item>
<item>
<title>Possible ClojureScript bug: corner case with regex literal compilation</title>
<link>https://ask.clojure.org/index.php/14717/possible-clojurescript-corner-regex-literal-compilation</link>
<description>&lt;p&gt;I've found what I believe to be a bug in ClojureScript regarding compilation of certain regex literals to JavaScript, a specific example being &lt;code&gt;#&quot;(?i)&quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In some cases, &lt;code&gt;#&quot;(?i)&quot;&lt;/code&gt; will be compiled to the JavaScript syntax &lt;code&gt;//i&lt;/code&gt;, which is in fact &lt;em&gt;not&lt;/em&gt; a JavaScript regex literal, but rather a JavaScript single line comment.  This then comments out all remaining code on the same generated line, resulting in a syntax error when the code is run on a JavaScript runtime.&lt;/p&gt;
&lt;p&gt;This minimal unit test example demonstrates the issue:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(ns regex-test&lt;/code&gt;&lt;br&gt;
&lt;code&gt;  (:require [cljs.test :refer-macros [deftest testing is]]))&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(deftest failing-test&lt;/code&gt;&lt;br&gt;
&lt;code&gt;  (testing &quot;Minimal reproduction&quot;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;    (is (not (nil? #&quot;(?i)&quot;)))))&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;As a side note, it's worth mentioning that &lt;code&gt;(?i)&lt;/code&gt; is not a valid native JavaScript regex in the first place, so I assume ClojureScript is trying to emulate compatibility with JVM regexes (where this is valid), and converting it to the nearest valid JS equivalent - either &lt;code&gt;(?i:)&lt;/code&gt; (e.g. at the REPL), or &lt;code&gt;//i&lt;/code&gt; (in compiled code, but which is syntactically not a JS regex literal at all).&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14717/possible-clojurescript-corner-regex-literal-compilation</guid>
<pubDate>Sun, 21 Sep 2025 02:59:22 +0000</pubDate>
</item>
<item>
<title>Is core.async.flow available in ClojureScript?</title>
<link>https://ask.clojure.org/index.php/14633/is-core-async-flow-available-in-clojurescript</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I know it's early days for core.async.flow but I thought I would give it a try in one of my ClojureScript projects.&lt;/p&gt;
&lt;p&gt;I've got &lt;code&gt;{:mvn/version &quot;1.9.808-alpha1&quot;}&lt;/code&gt; in my deps.edn but I'm getting the following error when I try to access the namespace:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;No such namespace: clojure.core.async.flow, could not locate clojure/core/async/flow.cljs&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Thanks for your help.&lt;/p&gt;
</description>
<category>core.async</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14633/is-core-async-flow-available-in-clojurescript</guid>
<pubDate>Thu, 17 Jul 2025 08:31:10 +0000</pubDate>
</item>
<item>
<title>Cannot compile namespace including `+` in clojurescript</title>
<link>https://ask.clojure.org/index.php/14551/cannot-compile-namespace-including-in-clojurescript</link>
<description>&lt;p&gt;Trying to compile any namespace including &lt;code&gt;+&lt;/code&gt; fails in clojurescript&lt;/p&gt;
&lt;p&gt;e.g.:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns test+.core)

(println &quot;Hello, World!&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;compiled with clojurescript &quot;1.12.42&quot; &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -M --main cljs.main --compile test+.core
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;results in&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; `Namespace test+.core does not exist.`
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Trying to include the namespace from another gives:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Unexpected error (ExceptionInfo) compiling at (REPL:1).
No such namespace: test+.core, could not locate test_PLUS_/core.cljs, test_PLUS_/core.cljc, or JavaScript source providing &quot;test+.core&quot; (Please check that namespaces with dashes use underscores in the ClojureScript file name) in file /home/sigvesn/clojure/cljs-test/src/other.cljs
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that it is possible to compile the namespace from regular clojure.&lt;/p&gt;
&lt;p&gt;This is relevant because the &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/tonsky/clojure-plus/&quot;&gt;clojure walk library&lt;/a&gt;  uses &lt;code&gt;+&lt;/code&gt; in the namespace&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/sigvesn/cljs-ns-special-char-error&quot;&gt;Repo with code to reproduce &lt;/a&gt;&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14551/cannot-compile-namespace-including-in-clojurescript</guid>
<pubDate>Tue, 20 May 2025 10:12:48 +0000</pubDate>
</item>
<item>
<title>Bug in Clojurescript string/split with limit?</title>
<link>https://ask.clojure.org/index.php/14514/bug-in-clojurescript-string-split-with-limit</link>
<description>&lt;p&gt;This seems like a bug to me? Using limit in clojure.string/split (in Clojurescript) gives the wrong result on a simple split.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; NB Clojurescript
(clojure.string/split &quot;a|b&quot; #&quot;|&quot;)
;=&amp;gt; [&quot;a&quot; &quot;|&quot; &quot;b&quot;]
(clojure.string/split &quot;a|b&quot; #&quot;|&quot; 3)
;=&amp;gt; [&quot;&quot; &quot;&quot; &quot;a|b&quot;]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Results should be the same?&lt;/p&gt;
&lt;p&gt;Corresponding code in Javascript&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&quot;a|b&quot;.split(/|/)
;=&amp;gt; ['a', '|', 'b']
&quot;a|b&quot;.split(/|/, 3)
;=&amp;gt; ['a', '|', 'b']
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14514/bug-in-clojurescript-string-split-with-limit</guid>
<pubDate>Wed, 23 Apr 2025 12:03:38 +0000</pubDate>
</item>
<item>
<title>Protocol function with placeholder _ arguments doesn't work as in Clojure</title>
<link>https://ask.clojure.org/index.php/14469/protocol-function-with-placeholder-arguments-doesnt-clojure</link>
<description>&lt;p&gt;A protocol like below will work in Clojure without issue, but in ClojureScript the _'s will apparently (quietly) override each other left to right.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defprotocol Linkable
  (-href [_ _ _]))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Even if the extend-protocol has unique names for the args, the dispatch seems to happen on the last argument.&lt;/p&gt;
&lt;p&gt;Repro at &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/valerauko/proto-repro/commit/a8ad51a225ed44ed134b28a18cc83d272d0d8321&quot;&gt;https://github.com/valerauko/proto-repro/commit/a8ad51a225ed44ed134b28a18cc83d272d0d8321&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Using distinct argument names in the defprotocol solves the issue. I think if it doesn't / can't work like in JVM Clojure it should warn about this issue.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14469/protocol-function-with-placeholder-arguments-doesnt-clojure</guid>
<pubDate>Mon, 17 Mar 2025 14:58:32 +0000</pubDate>
</item>
<item>
<title>ClojureScript: Destructuring two keys differing only on dash vs underscore doesn't work</title>
<link>https://ask.clojure.org/index.php/14370/clojurescript-destructuring-differing-underscore-doesnt</link>
<description>&lt;p&gt;When i try to destructure a key, supporting both kebab and snake case I run in to trouble:&lt;/p&gt;
&lt;p&gt;Sometimes both symbols pick up the same value:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [{:keys [foo-bar foo_bar] :as m} {:foo_bar 42}]
  [foo-bar (:foo-bar m) foo_bar (:foo_bar m)])
;;=&amp;gt; [42 nil 42 42]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Other times one symbol overshadows the other one:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [{:keys [foo-bar foo_bar
              a b c d e f g] :as m} {:foo_bar 42}]
  [foo-bar (:foo-bar m) foo_bar (:foo_bar m)])
;;=&amp;gt; [nil nil nil 42]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At least that's what I think is going on there: &lt;code&gt;foo-bar&lt;/code&gt; doesn't exist and gets the value &lt;code&gt;nil&lt;/code&gt;, overshadowing the symbol &lt;code&gt;foo_bar&lt;/code&gt; for which the value exists.&lt;/p&gt;
&lt;p&gt;This is supposedly a known limitation in ClojureScript, but I couldn't find it in &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/jira/software/c/projects/CLJS/issues&quot;&gt;the issue tracker&lt;/a&gt;. Nor does it seem like ChatGPT knows about it. Maybe it helps a bit to have it visible here for bots and humans alike.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14370/clojurescript-destructuring-differing-underscore-doesnt</guid>
<pubDate>Mon, 03 Feb 2025 16:09:41 +0000</pubDate>
</item>
<item>
<title>How to get interactive programming back when using shadow-cljs with dynamically rendered html</title>
<link>https://ask.clojure.org/index.php/14250/interactive-programming-using-shadow-dynamically-rendered</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am generating html dynamically on the server with hiccup. I am using the include-js macro to add the javascript that has been compiled from clojurescript to the hiccup template. The shadow-cljs cli just watches the clojurescript and just compiles the javascript.&lt;/p&gt;
&lt;p&gt;But when I use this approach I lose all the interactive programming that I have if I am using shadow-cljs with a statically rendered html file. &lt;/p&gt;
&lt;p&gt;Is it possible to get interactive programming with clojurescript where one evaluates expressions on the fly with a repl when using shadow-cljs while generating the html dynamically. &lt;/p&gt;
&lt;p&gt;I am assuming shadow-cljs is adding some interactive javascript to the statically rendered file that will make it possible to get the interactivity one wishes to get. Is it possible to add that missing piece to html that one is generating themselves?&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14250/interactive-programming-using-shadow-dynamically-rendered</guid>
<pubDate>Fri, 15 Nov 2024 12:04:42 +0000</pubDate>
</item>
<item>
<title>ClojureScript compiler does not transpile &quot;es8&quot; closure libraries</title>
<link>https://ask.clojure.org/index.php/14063/clojurescript-compiler-does-transpile-closure-libraries</link>
<description>&lt;p&gt;The ClojureScript compiler determines the type of the Closure library in the &lt;code&gt;transpile&lt;/code&gt; function. However, &lt;code&gt;:es8&lt;/code&gt;is not implemented.&lt;/p&gt;
&lt;p&gt;I have a fix for this, when a bug number has been assigned.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br&gt;
Hadil&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14063/clojurescript-compiler-does-transpile-closure-libraries</guid>
<pubDate>Tue, 20 Aug 2024 17:42:31 +0000</pubDate>
</item>
<item>
<title>How to load couple of modules with cljs.loader/load?</title>
<link>https://ask.clojure.org/index.php/13807/how-to-load-couple-of-modules-with-cljs-loader-load</link>
<description>&lt;p&gt;I didn't expect any problems with the task initially. Just loaded them one by one with cljs.loader/load until....&lt;br&gt;
Until I got 'beforeLoadModuleCode called with module module2 while module module1 is loading'&lt;br&gt;
First I realized that load was asynchronous and module loading wasn't actually finished when load exited. Digging goog.module.ModuleManager left me with an impression that its load() function is capable to queue new module loading until the previous one finishes loading.&lt;/p&gt;
&lt;p&gt;My impression that the problem is that cljs.loader/load calls beforeLoadModuleCode() at the wrong moment of time. It seems that it must be called at the very begining of evaluating the module code, not before it even starts to download it as it is now, i.e., setLoaded is the last instruction of the module and beforeLoadModuleCode must be the first.&lt;br&gt;
However, I'm still unsure I'm getting the whole idea behind ModuleManager correctly so I need a confirmation that I'm correct.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13807/how-to-load-couple-of-modules-with-cljs-loader-load</guid>
<pubDate>Sat, 06 Apr 2024 08:19:03 +0000</pubDate>
</item>
<item>
<title>Is it possible to get ClojureScript hot reload in a Chrome Extension?</title>
<link>https://ask.clojure.org/index.php/13786/is-possible-get-clojurescript-hot-reload-chrome-extension</link>
<description>&lt;p&gt;I've been working with Chrome Extensions for some time and it would be amazing to get ClojureScript hot reloading capabilities there.&lt;/p&gt;
&lt;p&gt;I tried Thomas Heller example &lt;code&gt;shadow-cljs&lt;/code&gt; project for Chrome Extensions and some other stuff that I documented in &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/marcelocra/repro-cljs-chrome-extension&quot;&gt;a minimum example repo&lt;/a&gt;, but with no success.&lt;/p&gt;
&lt;p&gt;In summary, seems like the Chrome Extensions' v3 manifest prohibits &lt;code&gt;eval&lt;/code&gt;, which means we are out of luck?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13786/is-possible-get-clojurescript-hot-reload-chrome-extension</guid>
<pubDate>Sat, 16 Mar 2024 14:17:48 +0000</pubDate>
</item>
<item>
<title>Clojurescript unable to use arrow constructors in body of defrecord, while Clojure does</title>
<link>https://ask.clojure.org/index.php/13785/clojurescript-unable-arrow-constructors-defrecord-clojure</link>
<description>&lt;p&gt;I get a warning if I try to compile a defrecord where a method tries to call the arrow constructor.&lt;/p&gt;
&lt;p&gt;This:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defrecord Foo [a b]
  SomeProtocol
  (some-method [_]
    (-&amp;gt;Foo new-a new-b)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;gives the message &quot;WARNING: Use of undeclared Var some.ns/-&amp;gt;Foo at line X&quot;. Clojure accepts this form ok.&lt;/p&gt;
&lt;p&gt;If I switch to the dot constructor version, like &lt;code&gt;(Foo. _ _)&lt;/code&gt; it compiles.&lt;/p&gt;
&lt;p&gt;I noticed that in the clj &lt;code&gt;defrecord&lt;/code&gt; macro, the symbols for &lt;code&gt;-&amp;gt;Foo&lt;/code&gt; and &lt;code&gt;map-&amp;gt;Foo&lt;/code&gt; are declared first thing, but in cljs, the related &lt;code&gt;build-positional-factory&lt;/code&gt; and &lt;code&gt;build-map-factory&lt;/code&gt; fns are called at the end, after &lt;code&gt;emit-defrecord&lt;/code&gt;. Perhaps that's the issue?&lt;/p&gt;
&lt;p&gt;It looks like deftype should have a similar issue, but I haven't tested it.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13785/clojurescript-unable-arrow-constructors-defrecord-clojure</guid>
<pubDate>Sat, 16 Mar 2024 08:14:12 +0000</pubDate>
</item>
<item>
<title>cljs.core/test does not work as the docstring describes</title>
<link>https://ask.clojure.org/index.php/13756/cljs-core-test-does-not-work-as-the-docstring-describes</link>
<description>&lt;p&gt;&lt;code&gt;cljs.core/test&lt;/code&gt; does not work according to its docstring description.&lt;/p&gt;
&lt;p&gt;The definition of cljs.core/test is&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn test
  &quot;test [v] finds fn at key :test in var metadata and calls it,
  presuming failure will throw exception&quot;
  [v]
  (let [f (.-cljs$lang$test v)]
    (if f
      (do (f) :ok)
      :no-test)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It's intended use, as far as I understand it, is as such (example copied from the documented Clojure version of the same function at ClojureDocs, &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojuredocs.org/clojure.core/test#example-542692cac026201cdc326b8a&quot;&gt;https://clojuredocs.org/clojure.core/test#example-542692cac026201cdc326b8a&lt;/a&gt; ):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn my-function
  &quot;this function adds two numbers&quot;
  {:test #(do
            (assert (= (my-function 2 3) 5))
            (assert (= (my-function 4 4) 8)))}
  ([x y] (+ x y)))

(test #'my-function)  ;equal to (test (var my-function))
=&amp;gt; :ok
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, &lt;code&gt;cljs.core/test&lt;/code&gt; enables functions to self-document their capabilities via tests made available in metadata under the &lt;code&gt;:test&lt;/code&gt; key.&lt;/p&gt;
&lt;p&gt;However, repeating the above in a CLJS environment yields a different result:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn my-function
  &quot;this function adds two numbers&quot;
  {:test #(do
            (assert (= (my-function 2 3) 5))
            (assert (= (my-function 4 4) 8)))}
  ([x y] (+ x y)))

(test #'my-function)
=&amp;gt; :no-test
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The interesting thing is that, given that I evalated the above in a CLJS REPL, the metadata &lt;em&gt;is&lt;/em&gt; available, as far as I can tell:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(meta #'my-function)
=&amp;gt;
{:ns cljs.user,
 :name my-function,
 :file &quot;&amp;lt;cljs repl&amp;gt;&quot;,
 :end-column 18,
 :source &quot;my-function&quot;,
 :column 1,
 :line 1,
 :end-line 1,
 :arglists ([x y]),
 :doc &quot;this function adds two numbers&quot;, 
 :test #object[Function]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This can be made even clearer by substituting the rather opaque function for a keyword:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn my-function
  &quot;this function adds two numbers&quot;
  {:test :just-a-keyword}
  ([x y] (+ x y)))

(meta #'my-function)
=&amp;gt;
{:ns cljs.user,
 :name my-function,
 :file &quot;&amp;lt;cljs repl&amp;gt;&quot;,
 :end-column 18,
 :source &quot;my-function&quot;,
 :column 1,
 :line 1,
 :end-line 1,
 :arglists ([x y]),
 :doc &quot;this function adds two numbers&quot;, 
 :test :just-a-keyword}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I spoke to @theller and @hiredman about this on the Clojurians Slack, and they speculated that &lt;code&gt;cljs.core/test&lt;/code&gt; has been repurposed to execute the body of &lt;code&gt;deftest&lt;/code&gt;s, since the two pieces seem to fit together. Observe:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[cljs.test :as test])
(test/deftest foo (test/is (= 1 2)))
=&amp;gt; #'cljs.user/foo

(test foo)
FAIL in () (&amp;lt;NO_SOURCE_FILE&amp;gt;:1:28)
expected: (= 1 2)
  actual: (not (= 1 2))

:ok
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;deftest&lt;/code&gt; body is executed and the keyword &lt;code&gt;:ok&lt;/code&gt; is returned (regardless of the &lt;code&gt;is&lt;/code&gt; result), as can also be gathered from reading definition of &lt;code&gt;cljs.core/test&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If it is true that &lt;code&gt;cljs.core/test&lt;/code&gt; has been repurposed in this manner, then two things are also true:&lt;/p&gt;
&lt;p&gt;A) If it ever were the intent that &lt;code&gt;cljs.core/test&lt;/code&gt; should enable testing &lt;code&gt;:test&lt;/code&gt; assertions for &lt;code&gt;defn&lt;/code&gt;s, that no longer holds.&lt;br&gt;
B) The docstring of &lt;code&gt;cljs.core/test&lt;/code&gt; is somewhat misleading.&lt;/p&gt;
&lt;p&gt;The first bit of the docstring, &lt;code&gt;&quot;test [v] finds fn at key :test in var metadata and calls it&quot;&lt;/code&gt;, may be technically correct, but mentions no connection with &lt;code&gt;deftest&lt;/code&gt;, and therefore somewhat unhelpful. &lt;/p&gt;
&lt;p&gt;The second bit of the docstring, &lt;code&gt;&quot;, presuming failure will throw exception&lt;/code&gt;&quot;, is certainly not correct when used for &lt;code&gt;deftest&lt;/code&gt; - the &lt;code&gt;cljs.test/is&lt;/code&gt; macro, which I think is fair to say that most &lt;code&gt;deftest&lt;/code&gt;s use, catches exceptions and reports instead. I think the original intent is that the execption is thrown, so &lt;code&gt;:ok&lt;/code&gt; is not returned, but in this context, that construct fails.&lt;/p&gt;
&lt;p&gt;The docstring seems to be a carbon copy of the Clojure version, so possibly, it warrants an update. Or maybe &lt;code&gt;cljs.core/test&lt;/code&gt; is simply unused and redundant at this point?&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13756/cljs-core-test-does-not-work-as-the-docstring-describes</guid>
<pubDate>Tue, 27 Feb 2024 12:33:17 +0000</pubDate>
</item>
<item>
<title>What's an ideomatic way to manage state in a library?</title>
<link>https://ask.clojure.org/index.php/13734/whats-an-ideomatic-way-to-manage-state-in-a-library</link>
<description>&lt;p&gt;I’m porting a JS library to clojure (and, potentially cljs), and I’m struggling with reasoning about local state. Imagine a scenario where you do RPC over websockets, and the server reply contextually depend on what the server had already sent you. You'd want to keep a local cache of the replies from the server, then.&lt;/p&gt;
&lt;p&gt;In OOP world it's expected you incapsulate both the socket and the cache and provide the library users an interface that sends RPCs and transparently handles the cache population and pulling results from it. What would be the ideomatic way to do the same in clojure[-script]? Would I just return a map and expect my functions to take it as a first argument, returning the update state along with the rpc result?&lt;/p&gt;
</description>
<category>Refs, agents, atoms</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13734/whats-an-ideomatic-way-to-manage-state-in-a-library</guid>
<pubDate>Thu, 15 Feb 2024 12:46:36 +0000</pubDate>
</item>
<item>
<title>Support for js/BigInt</title>
<link>https://ask.clojure.org/index.php/13676/support-for-js-bigint</link>
<description>&lt;p&gt;Native support for BigInt in JavaScript has been around since 2020. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt&lt;/a&gt;) &lt;/p&gt;
&lt;p&gt;Any chance of support for this in ClojureScript any time soon?&lt;/p&gt;
&lt;p&gt;Would be nice to be able to use this as a number in numeric ops and as a key in hash maps. &lt;br&gt;
Also, cljs.core could be extended with functions like &lt;code&gt;bigint&lt;/code&gt; and &lt;code&gt;integer?&lt;/code&gt; from clojure.core.&lt;/p&gt;
&lt;p&gt;BigInts would bring clojurescript one step closer to supporting Ratios.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13676/support-for-js-bigint</guid>
<pubDate>Fri, 09 Feb 2024 13:32:21 +0000</pubDate>
</item>
<item>
<title>Do you use arity 3 or higher comparisons such as = &lt; &lt;= &gt; &gt;= == in performance sensitive code?</title>
<link>https://ask.clojure.org/index.php/13627/arity-higher-comparisons-such-performance-sensitive-code</link>
<description>&lt;p&gt;For comparisons (&lt;code&gt;= &amp;lt; &amp;lt;= &amp;gt; &amp;gt;= ==&lt;/code&gt;) arity 3 and higher are much slower than doing e.g. &lt;code&gt;(and (&amp;lt; a b) (&amp;lt; b c))&lt;/code&gt;. The arity 3 is in my research rather less common but still used in e.g. Manifold stream.clj [0] or rrb_vector rrbt.clj [1]. Arity 3 is idiomatic in places, where you compare lower and upper bound for a &quot;variable&quot;. However, I don't think arity 4 and higher is used much in practical code. At least I haven't found any interesting instances of such a use.&lt;/p&gt;
&lt;p&gt;An example implementation (based on the one currently in core) could be:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn &amp;lt;'
  &quot;Returns non-nil if nums are in monotonically increasing order,
  otherwise false.&quot;
  {:inline         (fn [x y] `(. clojure.lang.Numbers (lt ~x ~y)))
   :inline-arities #{2}
   :added          &quot;1.0&quot;}
  ([x] true)
  ([x y] (. clojure.lang.Numbers (lt x y)))
  ([x y z] (and (&amp;lt;' x y) (&amp;lt;' y z)))
  ([x y z &amp;amp; more]
   (if (&amp;lt;' x y z)
     (if (next more)
       (recur y z (first more) (next more))
       (&amp;lt;' z (first more)))
     false)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;[0] &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clj-commons/manifold/blob/c3fc69066f3abba0b5ab0f4c2b1c4338bcc61d19/src/manifold/stream.clj#L978&quot;&gt;https://github.com/clj-commons/manifold/blob/c3fc69066f3abba0b5ab0f4c2b1c4338bcc61d19/src/manifold/stream.clj#L978&lt;/a&gt;&lt;br&gt;
[1] &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.rrb-vector/blob/master/src/main/clojure/clojure/core/rrb_vector/rrbt.clj&quot;&gt;https://github.com/clojure/core.rrb-vector/blob/master/src/main/clojure/clojure/core/rrb_vector/rrbt.clj&lt;/a&gt;&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13627/arity-higher-comparisons-such-performance-sensitive-code</guid>
<pubDate>Tue, 16 Jan 2024 22:14:09 +0000</pubDate>
</item>
<item>
<title>ClojureScript and the deprecation of Google Closure Library</title>
<link>https://ask.clojure.org/index.php/13612/clojurescript-and-the-deprecation-google-closure-library</link>
<description>&lt;p&gt;Google &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/google/closure-library/issues/1214&quot;&gt;announced recently&lt;/a&gt; that they will be sunsetting the Closure Library (not Closure itself).&lt;/p&gt;
&lt;p&gt;Does this impact ClojureScript in any meaningful way?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13612/clojurescript-and-the-deprecation-google-closure-library</guid>
<pubDate>Fri, 12 Jan 2024 16:33:30 +0000</pubDate>
</item>
<item>
<title>MUI Select - add deselect function</title>
<link>https://ask.clojure.org/index.php/13551/mui-select-add-deselect-function</link>
<description>&lt;pre&gt;&lt;code&gt;(defn- menu-item
  [value-fn label-fn state lang index item]
(let [value (value-fn item)
    label (label-fn item lang)]
^{:key index}
[:&amp;gt; m/MenuItem {:value   value
                :data-cy (-&amp;gt; (str value) (str/lower-case) (str/replace &quot; &quot; &quot;-&quot;) (str &quot;-menu-item&quot;))}
 [:&amp;gt; m/Checkbox {:checked (= (value-fn state) value)}]
 [:&amp;gt; m/Typography {} label]
 ]))
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;(defn select
  [{:keys [data state-fn disabled? label value-fn label-fn data-cy variant]}]
  (let [rf-lang   (rf/subscribe [:current-language])
        label-fn1 (or label-fn (fn [item lang] (value-fn item)))]
    (fn [{:keys [data state-fn disabled? label value-fn data-cy variant]}]
      (let [lang  @rf-lang
            state (state-fn)
            props (cond-&amp;gt;
                    {:select      true
                     :full-width  true
                     :SelectProps {:MenuProps    {:getContentAnchorEl nil}
                                   :render-value (fn [items]
                                               (if label-fn
                                                 (label-fn state lang)
                                                 (map identity items)))
                               :data-cy      data-cy}
                 :value       (or (value-fn state) &quot;&quot;)
                 :on-change   (fn [e]
                                (let [selected (.. e -target -value)]
                                  (state-fn (first (filter #(= selected (value-fn %)) data)))))
                 :label       (i18n/translation label lang)
                 :disabled    disabled?}
                variant (assoc :variant variant))]
    [:&amp;gt; m/TextField props (map-indexed (partial menu-item value-fn label-fn1 state lang) data)]))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I have the following piece of code to create a dropdown list with items that have a checkbox next to them. The problem is that the checkbox cannot be removed. When the user clicks on an already selected checkbox, nothing happens. And in this case, it should become deselect.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13551/mui-select-add-deselect-function</guid>
<pubDate>Wed, 13 Dec 2023 11:43:41 +0000</pubDate>
</item>
<item>
<title>clojure.pprint/pprint bug when using the code-dispatch table</title>
<link>https://ask.clojure.org/index.php/13455/clojure-pprint-pprint-bug-when-using-the-code-dispatch-table</link>
<description>&lt;p&gt;There seams to be a bug in clojure.pprint/pprint when using the code-dispatch table  and printing let. It happens on Clojure and ClojureScript.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.11.1
user=&amp;gt; (require '[clojure.pprint :as pp])

user=&amp;gt; 
(binding [pp/*print-pprint-dispatch* pp/code-dispatch]
  (pp/pprint
   '(let)))

((let)) ;; prints some extra parenthesis

(binding [pp/*print-pprint-dispatch* pp/code-dispatch]
  (pp/pprint
   '(let*)))

(let*) ;; doesn't happen when pprinting any other form
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Printing</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13455/clojure-pprint-pprint-bug-when-using-the-code-dispatch-table</guid>
<pubDate>Fri, 10 Nov 2023 14:06:05 +0000</pubDate>
</item>
<item>
<title>Can't add #inst values to var metadata. Error: Not supported: class java.time.Instant</title>
<link>https://ask.clojure.org/index.php/13362/cant-inst-values-metadata-error-supported-class-java-instant</link>
<description>&lt;p&gt;I wasn't able to add #inst values to var metadata. Compilation failed to &lt;code&gt;Not supported: class java.time.Instant&lt;/code&gt; error&lt;/p&gt;
&lt;p&gt;Steps to reproduce:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ mkdir src
$ echo '(ns core) (def ^{:time #inst &quot;2023-10-07&quot;} foo :foo)' &amp;gt; src/core.cljs
$ clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version &quot;1.11.60&quot;}}}' -M --main cljs.main --compile core
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Expected: Compilation is successful&lt;/p&gt;
&lt;p&gt;Actual:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Unexpected error compiling at (REPL:1).
Not supported: class java.time.Instant

Full report at:
/var/folders/0p/vtdv4p053pd6gkx8d5p98h000000gn/T/clojure-15941611179751768055.edn
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Analysis:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/jira/software/c/projects/CLJS/issues/CLJS-3291&quot;&gt;CLJS-3291&lt;/a&gt; changed the #inst reader to produce &lt;code&gt;java.time.Instant&lt;/code&gt; instead of &lt;code&gt;java.util.Date&lt;/code&gt;. The analysis cache transit writer is failing to write &lt;code&gt;java.time.Instant&lt;/code&gt; because it only knows how to serialize &lt;code&gt;java.util.Date&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Workaround:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def foo :foo)
(alter-meta #'foo assoc :time #inst &quot;2023-10-07&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Full report:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:clojure.main/message
 &quot;Unexpected error compiling at (REPL:1).\nNot supported: class java.time.Instant\n&quot;,
 :clojure.main/triage
 {:file
  #object[java.io.File 0x608f79a8 &quot;/Users/mikko/Documents/Projects/sharetribe/instant-cljs2/src/core.cljs&quot;],
  :clojure.error/phase :compilation,
  :clojure.error/class java.lang.Exception,
  :clojure.error/cause &quot;Not supported: class java.time.Instant&quot;},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.ExceptionInfo,
    :message
    &quot;failed compiling file:/Users/mikko/Documents/Projects/sharetribe/instant-cljs2/src/core.cljs&quot;,
    :data
    {:file
     #object[java.io.File 0x608f79a8 &quot;/Users/mikko/Documents/Projects/sharetribe/instant-cljs2/src/core.cljs&quot;],
     :clojure.error/phase :compilation},
    :at
    [cljs.compiler$compile_file$fn__4809 invoke &quot;compiler.cljc&quot; 1768]}
   {:type java.lang.RuntimeException,
    :message
    &quot;java.lang.Exception: Not supported: class java.time.Instant&quot;,
    :at
    [com.cognitect.transit.impl.WriterFactory$1
     write
     &quot;WriterFactory.java&quot;
     65]}
   {:type java.lang.Exception,
    :message &quot;Not supported: class java.time.Instant&quot;,
    :at
    [com.cognitect.transit.impl.AbstractEmitter
     marshal
     &quot;AbstractEmitter.java&quot;
     195]}],
  :trace
  [[com.cognitect.transit.impl.AbstractEmitter
    marshal
    &quot;AbstractEmitter.java&quot;
    195]
   [com.cognitect.transit.impl.JsonEmitter
    emitMap
    &quot;JsonEmitter.java&quot;
    171]
   [com.cognitect.transit.impl.AbstractEmitter
    emitMap
    &quot;AbstractEmitter.java&quot;
    86]
   [com.cognitect.transit.impl.AbstractEmitter
    marshal
    &quot;AbstractEmitter.java&quot;
    185]
   [com.cognitect.transit.impl.JsonEmitter
    emitMap
    &quot;JsonEmitter.java&quot;
    171]
   [com.cognitect.transit.impl.AbstractEmitter
    emitMap
    &quot;AbstractEmitter.java&quot;
    86]
   [com.cognitect.transit.impl.AbstractEmitter
    marshal
    &quot;AbstractEmitter.java&quot;
    185]
   [com.cognitect.transit.impl.JsonEmitter
    emitMap
    &quot;JsonEmitter.java&quot;
    171]
   [com.cognitect.transit.impl.AbstractEmitter
    emitMap
    &quot;AbstractEmitter.java&quot;
    86]
   [com.cognitect.transit.impl.AbstractEmitter
    marshal
    &quot;AbstractEmitter.java&quot;
    185]
   [com.cognitect.transit.impl.JsonEmitter
    emitMap
    &quot;JsonEmitter.java&quot;
    171]
   [com.cognitect.transit.impl.AbstractEmitter
    emitMap
    &quot;AbstractEmitter.java&quot;
    86]
   [com.cognitect.transit.impl.AbstractEmitter
    marshal
    &quot;AbstractEmitter.java&quot;
    185]
   [com.cognitect.transit.impl.AbstractEmitter
    marshalTop
    &quot;AbstractEmitter.java&quot;
    212]
   [com.cognitect.transit.impl.JsonEmitter emit &quot;JsonEmitter.java&quot; 41]
   [com.cognitect.transit.impl.WriterFactory$1
    write
    &quot;WriterFactory.java&quot;
    62]
   [cljs.vendor.cognitect.transit$write invokeStatic &quot;transit.clj&quot; 171]
   [cljs.vendor.cognitect.transit$write invoke &quot;transit.clj&quot; 168]
   [cljs.analyzer$write_analysis_cache$fn__3960
    invoke
    &quot;analyzer.cljc&quot;
    4771]
   [cljs.analyzer$write_analysis_cache
    invokeStatic
    &quot;analyzer.cljc&quot;
    4770]
   [cljs.analyzer$write_analysis_cache invoke &quot;analyzer.cljc&quot; 4757]
   [cljs.compiler$emit_source invokeStatic &quot;compiler.cljc&quot; 1642]
   [cljs.compiler$emit_source invoke &quot;compiler.cljc&quot; 1557]
   [cljs.compiler$compile_file_STAR_$fn__4778
    invoke
    &quot;compiler.cljc&quot;
    1671]
   [cljs.compiler$with_core_cljs invokeStatic &quot;compiler.cljc&quot; 1477]
   [cljs.compiler$with_core_cljs invoke &quot;compiler.cljc&quot; 1466]
   [cljs.compiler$compile_file_STAR_ invokeStatic &quot;compiler.cljc&quot; 1655]
   [cljs.compiler$compile_file_STAR_ invoke &quot;compiler.cljc&quot; 1648]
   [cljs.compiler$compile_file$fn__4809 invoke &quot;compiler.cljc&quot; 1753]
   [cljs.compiler$compile_file invokeStatic &quot;compiler.cljc&quot; 1728]
   [cljs.compiler$compile_file invoke &quot;compiler.cljc&quot; 1704]
   [cljs.closure$compile_file invokeStatic &quot;closure.clj&quot; 657]
   [cljs.closure$compile_file invoke &quot;closure.clj&quot; 635]
   [cljs.closure$fn__6472 invokeStatic &quot;closure.clj&quot; 731]
   [cljs.closure$fn__6472 invoke &quot;closure.clj&quot; 725]
   [cljs.closure$fn__6381$G__6374__6388 invoke &quot;closure.clj&quot; 553]
   [cljs.closure$compile_sources$iter__6598__6602$fn__6603
    invoke
    &quot;closure.clj&quot;
    1102]
   [clojure.lang.LazySeq sval &quot;LazySeq.java&quot; 42]
   [clojure.lang.LazySeq seq &quot;LazySeq.java&quot; 51]
   [clojure.lang.Cons next &quot;Cons.java&quot; 39]
   [clojure.lang.RT next &quot;RT.java&quot; 713]
   [clojure.core$next__5451 invokeStatic &quot;core.clj&quot; 64]
   [clojure.core$dorun invokeStatic &quot;core.clj&quot; 3143]
   [clojure.core$doall invokeStatic &quot;core.clj&quot; 3149]
   [clojure.core$doall invoke &quot;core.clj&quot; 3149]
   [cljs.closure$compile_sources invokeStatic &quot;closure.clj&quot; 1098]
   [cljs.closure$compile_sources invoke &quot;closure.clj&quot; 1087]
   [cljs.closure$build invokeStatic &quot;closure.clj&quot; 3200]
   [cljs.closure$build invoke &quot;closure.clj&quot; 3104]
   [cljs.build.api$build invokeStatic &quot;api.clj&quot; 231]
   [cljs.build.api$build invoke &quot;api.clj&quot; 212]
   [cljs.cli$default_compile invokeStatic &quot;cli.clj&quot; 530]
   [cljs.cli$default_compile invoke &quot;cli.clj&quot; 486]
   [cljs.cli$compile_opt invokeStatic &quot;cli.clj&quot; 542]
   [cljs.cli$compile_opt invoke &quot;cli.clj&quot; 540]
   [cljs.cli$main invokeStatic &quot;cli.clj&quot; 703]
   [cljs.cli$main doInvoke &quot;cli.clj&quot; 692]
   [clojure.lang.RestFn applyTo &quot;RestFn.java&quot; 139]
   [clojure.core$apply invokeStatic &quot;core.clj&quot; 669]
   [clojure.core$apply invoke &quot;core.clj&quot; 662]
   [cljs.main$_main invokeStatic &quot;main.clj&quot; 65]
   [cljs.main$_main doInvoke &quot;main.clj&quot; 56]
   [clojure.lang.RestFn applyTo &quot;RestFn.java&quot; 137]
   [clojure.lang.Var applyTo &quot;Var.java&quot; 705]
   [clojure.core$apply invokeStatic &quot;core.clj&quot; 667]
   [clojure.main$main_opt invokeStatic &quot;main.clj&quot; 514]
   [clojure.main$main_opt invoke &quot;main.clj&quot; 510]
   [clojure.main$main invokeStatic &quot;main.clj&quot; 664]
   [clojure.main$main doInvoke &quot;main.clj&quot; 616]
   [clojure.lang.RestFn applyTo &quot;RestFn.java&quot; 137]
   [clojure.lang.Var applyTo &quot;Var.java&quot; 705]
   [clojure.main main &quot;main.java&quot; 40]],
  :cause &quot;Not supported: class java.time.Instant&quot;,
  :phase :compilation}}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13362/cant-inst-values-metadata-error-supported-class-java-instant</guid>
<pubDate>Sat, 07 Oct 2023 19:28:05 +0000</pubDate>
</item>
<item>
<title>Use transducer arity of `into` in `clojure.walk` namespace</title>
<link>https://ask.clojure.org/index.php/13281/use-transducer-arity-of-into-in-clojure-walk-namespace</link>
<description>&lt;p&gt;It's simple. Just like that:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; clojure.walk/walk:
(outer (reduce (fn [r x] (conj r (inner x))) form form))
=&amp;gt; (outer (into form (map inner) form))
(outer (into (empty form) (map inner form)))
=&amp;gt; (outer (into (empty form) (map inner) form))
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; clojure.walk/keywordize-keys:
(postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)
=&amp;gt; (postwalk (fn [x] (if (map? x) (into {} (map f) x) x)) m)
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; clojure.walk/strigify-keys:
(postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)
=&amp;gt; (postwalk (fn [x] (if (map? x) (into {} (map f) x) x)) m)
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Collections</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13281/use-transducer-arity-of-into-in-clojure-walk-namespace</guid>
<pubDate>Wed, 13 Sep 2023 22:49:05 +0000</pubDate>
</item>
<item>
<title>Clojurescript issue in 1.11.121 and master when compiling</title>
<link>https://ask.clojure.org/index.php/13279/clojurescript-issue-in-1-11-121-and-master-when-compiling</link>
<description>&lt;p&gt;When compiling a file with :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:paths [&quot;src&quot;] :deps {org.clojure/clojurescript {:mvn/version &quot;1.11.121&quot;}}}' -M -m cljs.main -co '{:main org.foo.myscript}' --compile
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the compilation will work fine, but if after that you run cljs.main --repl the browser repl will start, but evaluating forms on it will not work since evaluation will never finish.&lt;/p&gt;
&lt;p&gt;This exact same commands work fine in 1.11.60.&lt;/p&gt;
&lt;p&gt;After some debugging the issue seems to be caused by the current compiler never adding &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;document.write('&amp;lt;script&amp;gt;goog.require(&quot;clojure.browser.repl.preload&quot;);&amp;lt;/script&amp;gt;'); 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to the resulting js file.&lt;/p&gt;
&lt;p&gt;This is caused by :&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L2500-L2501&quot;&gt;https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L2500-L2501&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;not adding the preload because :browser-repl isn't true. &lt;/p&gt;
&lt;p&gt;The breaking change comes from this line:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/cli.clj#L498&quot;&gt;https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/cli.clj#L498&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;which removes :browser-repl from the options because we are just compiling and there is no repl involved.&lt;/p&gt;
&lt;p&gt;Looks like the behavior was explicitly changed by this commit :&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojurescript/commit/9c01d9b0a70ada1cb17cf3ce65ae93d76d0d3b08&quot;&gt;https://github.com/clojure/clojurescript/commit/9c01d9b0a70ada1cb17cf3ce65ae93d76d0d3b08&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Reverting the commit fixes the issue.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13279/clojurescript-issue-in-1-11-121-and-master-when-compiling</guid>
<pubDate>Tue, 12 Sep 2023 22:01:58 +0000</pubDate>
</item>
<item>
<title>How to transform js/Error to a clojurescript map?</title>
<link>https://ask.clojure.org/index.php/13176/how-to-transform-js-error-to-a-clojurescript-map</link>
<description>&lt;p&gt;I'm getting a &lt;code&gt;js/Error&lt;/code&gt; in my &lt;code&gt;catch&lt;/code&gt; form of &lt;code&gt;try/catch&lt;/code&gt;.  I was doing some repl work to see what I can understand about &lt;code&gt;js/Error&lt;/code&gt;s.  What I don't understand is why &lt;code&gt;(js-&amp;gt;clj js-err)&lt;/code&gt; just returns the same &lt;code&gt;js/Error&lt;/code&gt; object.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def js-err (js/Error. &quot;testing&quot;))

js-err
;; =&amp;gt; #object[Error Error: testing]
(js-&amp;gt;clj js-err)
;; =&amp;gt; #object[Error Error: testing]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;evaluating &lt;code&gt;js-err&lt;/code&gt; and &lt;code&gt;(js-&amp;gt;clj js-err)&lt;/code&gt; result in the same thing.&lt;/p&gt;
&lt;p&gt;Here are the properties on &lt;code&gt;js-err&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(.getOwnPropertyNames js/Object js-err)
;; =&amp;gt; #js[&quot;stack&quot; &quot;message&quot;]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;what I want or expect to happen:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(js-&amp;gt;clj js-err)
;; =&amp;gt; {:message &quot;testing&quot;
;;     :stack &quot;blah\nblah&quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Could someone explain why &lt;code&gt;js-&amp;gt;clj&lt;/code&gt; doesn't give me the object data as a map, and is there a idiomatic way to accomplish turning that object into a map?&lt;/p&gt;
&lt;p&gt;This is in the nodejs host&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13176/how-to-transform-js-error-to-a-clojurescript-map</guid>
<pubDate>Mon, 21 Aug 2023 14:54:16 +0000</pubDate>
</item>
<item>
<title>Setting `warning-handlers` in a config file fails with &quot;Wrong number of args (3) passed to: clojure.lang.Symbol&quot;</title>
<link>https://ask.clojure.org/index.php/13175/setting-warning-handlers-config-number-passed-clojure-symbol</link>
<description>&lt;p&gt;This config:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:main             warning-handlers
 :warning-handlers [cljs.analyzer/default-warning-handler]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Which set &lt;code&gt;:warning-handlers&lt;/code&gt; to the default as listed in &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurescript.org/reference/compiler-options#warning-handlers&quot;&gt;https://clojurescript.org/reference/compiler-options#warning-handlers&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Compiled using: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -M --main cljs.main --compile-opts compile.edn --compile
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Fails with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;   {:type clojure.lang.ExceptionInfo,
    :message
    &quot;Wrong number of args (3) passed to: clojure.lang.Symbol at line 1 /Users/danie/matter/source/cljs-config/src/warning_handlers.cljs&quot;,
    :data
    {:file
     #object[java.io.File 0x27f8f1cc &quot;/Users/danie/matter/source/cljs-config/src/warning_handlers.cljs&quot;],
     :line 1,
     :column 1,
     :tag :cljs/analysis-error},
    :at [cljs.analyzer$error invokeStatic &quot;analyzer.cljc&quot; 780]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Full repro here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/danieroux/cljs-config&quot;&gt;https://github.com/danieroux/cljs-config&lt;/a&gt;&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13175/setting-warning-handlers-config-number-passed-clojure-symbol</guid>
<pubDate>Sun, 20 Aug 2023 23:30:21 +0000</pubDate>
</item>
<item>
<title>Problem with leiningen and a local library</title>
<link>https://ask.clojure.org/index.php/13157/problem-with-leiningen-and-a-local-library</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have two ClojureScript projects. From the first one (html-ui-lib) I created a JAR file with the following commands and installed it in a local repository:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;lein with-profile prod jar
lein localrepo install -r /home/muenkel/soft/Global/clojure-repo target/html-ui-lib-0.1.2-SNAPSHOT.jar html-ui-lib 0.1.2-SNAPSHOT
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the second project (via-trans) I try to use this library. For this purpose I have included the library in the project file. Unfortunately, not all files of the JAR file are installed. What am I doing wrong?&lt;/p&gt;
&lt;p&gt;Here is the content of the JAR file:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt; 245 Fri Aug 11 00:02:34 CEST 2023 META-INF/MANIFEST.MF&lt;br&gt;
  3268 Fri Aug 11 00:02:34 CEST 2023 META-INF/maven/html-ui-lib/html-ui-lib/pom.xml&lt;br&gt;
  3183 Fri Aug 11 00:02:34 CEST 2023 META-INF/leiningen/html-ui-lib/html-ui-lib/project.clj&lt;br&gt;
   783 Fri Aug 11 00:02:34 CEST 2023 META-INF/leiningen/html-ui-lib/html-ui-lib/README.md&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; 0 Fri Aug 11 00:02:32 CEST 2023 META-INF/
 0 Fri Aug 11 00:02:32 CEST 2023 META-INF/maven/
 0 Fri Aug 11 00:02:32 CEST 2023 META-INF/maven/html-ui-lib/
 0 Fri Aug 11 00:02:32 CEST 2023 META-INF/maven/html-ui-lib/html-ui-lib/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   158 Fri Aug 11 00:02:32 CEST 2023 META-INF/maven/html-ui-lib/html-ui-lib/pom.properties&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; 0 Fri Aug 11 00:01:30 CEST 2023 public/
 0 Tue Jul 11 23:15:06 CEST 2023 public/css/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;  2715 Tue Jul 11 23:15:06 CEST 2023 public/css/style.css&lt;br&gt;
   151 Sun Mar 26 21:35:54 CEST 2023 public/test.html&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; 0 Fri Aug 11 00:02:32 CEST 2023 public/cljs-out/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   554 Mon Apr 17 22:11:34 CEST 2023 public/index.html&lt;br&gt;
   417 Sat Apr 08 23:03:08 CEST 2023 public/devcards.html&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; 0 Sat Jul 22 23:08:08 CEST 2023 html_ui_lib/
 0 Wed May 10 20:49:58 CEST 2023 html_ui_lib/util/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;  1100 Wed May 10 20:49:58 CEST 2023 html_ui_lib/util/limit-lines.cljs&lt;br&gt;
  1123 Thu May 04 23:27:52 CEST 2023 html_ui_lib/core.cljs&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; 0 Tue Jul 18 21:06:24 CEST 2023 html_ui_lib/spec/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   272 Sun Jun 04 00:13:12 CEST 2023 html_ui_lib/spec/email-value-specs.cljs&lt;br&gt;
  1883 Tue Jul 18 21:06:24 CEST 2023 html_ui_lib/spec/value_specs.cljs&lt;br&gt;
   213 Wed Jun 07 23:31:32 CEST 2023 html_ui_lib/spec/text_value_specs.cljs&lt;br&gt;
  3871 Wed Jun 07 23:14:28 CEST 2023 html_ui_lib/spec/ui-specs.cljs&lt;br&gt;
   267 Wed Jun 07 23:26:06 CEST 2023 html_ui_lib/spec/number_value_specs.cljs&lt;br&gt;
   185 Sat May 20 23:56:54 CEST 2023 html_ui_lib/spec/date_value_specs.cljs&lt;br&gt;
   178 Wed May 31 00:26:16 CEST 2023 html_ui_lib/spec/drop_down_value_specs.cljs&lt;br&gt;
  1545 Mon Jul 17 22:55:08 CEST 2023 html_ui_lib/spec/type_specs.cljs&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; 0 Tue Jul 18 20:59:58 CEST 2023 html_ui_lib/ui/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;  3234 Tue Jun 06 21:32:30 CEST 2023 html_ui_lib/ui/input_email.cljs&lt;br&gt;
  4298 Tue Jul 18 20:59:58 CEST 2023 html_ui_lib/ui/tree_view.cljs&lt;br&gt;
  3361 Wed May 24 22:41:30 CEST 2023 html_ui_lib/ui/input_text.cljs&lt;br&gt;
  3420 Sat Jun 03 21:42:24 CEST 2023 html_ui_lib/ui/input_date.cljs&lt;br&gt;
  6013 Wed Jun 07 23:35:28 CEST 2023 html_ui_lib/ui/input_number.cljs&lt;br&gt;
  2029 Wed Jul 12 22:42:44 CEST 2023 html_ui_lib/ui/core.cljs&lt;br&gt;
   396 Fri Apr 07 21:19:26 CEST 2023 html_ui_lib/ui/button.cljs&lt;br&gt;
   844 Tue Jul 11 23:13:50 CEST 2023 html_ui_lib/ui/output_boolean.cljs&lt;br&gt;
  1127 Wed Jul 12 23:57:34 CEST 2023 html_ui_lib/ui/input_checkbox.cljs&lt;br&gt;
   276 Sun Apr 23 22:59:54 CEST 2023 html_ui_lib/ui/grid_container.cljs&lt;br&gt;
   603 Thu Jun 08 22:50:00 CEST 2023 html_ui_lib/ui/output_number.cljs&lt;br&gt;
  1613 Mon Jul 10 21:58:34 CEST 2023 html_ui_lib/ui/input_radio.cljs&lt;br&gt;
   381 Sun Apr 09 00:16:22 CEST 2023 html_ui_lib/ui/table.cljs&lt;br&gt;
  1775 Sat Jul 01 22:19:10 CEST 2023 html_ui_lib/ui/drop_down_list.cljs&lt;br&gt;
  2789 Wed Jun 28 22:57:44 CEST 2023 html_ui_lib/ui/leaf_template.cljs&lt;br&gt;
   313 Thu Jun 08 23:19:22 CEST 2023 html_ui_lib/ui/output_text.cljs&lt;br&gt;
  2160 Thu Jul 13 23:36:30 CEST 2023 html_ui_lib/ui/input_password.cljs&lt;br&gt;
   519 Wed Jun 07 22:44:34 CEST 2023 html_ui_lib/test_runner.cljs&lt;br&gt;
   860 Wed Jun 07 22:57:28 CEST 2023 html_ui_lib/number_value_specs_test.cljs&lt;br&gt;
   273 Wed May 24 21:17:16 CEST 2023 html_ui_lib/text_value_specs_test.cljs&lt;br&gt;
  1090 Tue May 30 23:24:06 CEST 2023 html_ui_lib/value_specs_test.cljs&lt;br&gt;
  7280 Wed Jun 07 23:07:38 CEST 2023 html_ui_lib/ui_specs_test.cljs&lt;br&gt;
  2274 Wed May 24 21:37:08 CEST 2023 html_ui_lib/type_specs_test.cljs&lt;br&gt;
   305 Wed May 24 23:44:04 CEST 2023 html_ui_lib/drop_down_value_specs_test.cljs&lt;br&gt;
   260 Sun Mar 26 21:35:54 CEST 2023 html_ui_lib/core_test.cljs&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here, on the other hand, is the content of the directory with the library. As you can see, only the files of the namespace ui are contained here:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;via-trans/resources/public/cljs-out/dev/html_ui_lib/
└── ui
    ├── core.cljs
    ├── core.cljs.cache.json
    ├── core.js
    ├── core.js.map
    ├── input_text.cljs
    └── input_text.js
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is the project.clj file of html_ui_lib:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;(defproject html-ui-lib &quot;0.1.2-SNAPSHOT&quot;&lt;br&gt;
  :description &quot;FIXME: write this!&quot;&lt;br&gt;
  :url &quot;&lt;a rel=&quot;nofollow&quot; href=&quot;http://example.com/FIXME&quot;&gt;http://example.com/FIXME&lt;/a&gt;&quot;&lt;br&gt;
  :license {:name &quot;Eclipse Public License&quot;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        :url &quot;http://www.eclipse.org/legal/epl-v10.html&quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;  :min-lein-version &quot;2.7.1&quot;&lt;br&gt;
  :dependencies [[clj-commons/citrus &quot;3.3.0&quot;]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;             [cljs-ajax &quot;0.8.1&quot;]
             [funcool/struct &quot;1.4.0&quot;]
             [org.clojure/clojure &quot;1.10.0&quot;]
             [org.clojure/clojurescript &quot;1.11.60&quot;]
             [rum &quot;0.12.10&quot;]]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;;;:deps {io.github.clj-kondo/config-rum-rum {:mvn/version &quot;0.12.10&quot;}}&lt;br&gt;
  :global-vars {&lt;em&gt;warn-on-reflection&lt;/em&gt; true}&lt;br&gt;
  ;;:global-vars {&lt;em&gt;asserts&lt;/em&gt; false}&lt;br&gt;
  :source-paths [&quot;src/cljs&quot; &quot;test/cljs&quot;]&lt;br&gt;
  :aliases {&quot;fig:build&quot; [&quot;trampoline&quot; &quot;run&quot; &quot;-m&quot; &quot;figwheel.main&quot; &quot;-b&quot; &quot;dev&quot; &quot;-r&quot;]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        &quot;fig:min&quot;   [&quot;run&quot; &quot;-m&quot; &quot;figwheel.main&quot; &quot;-O&quot; &quot;advanced&quot; &quot;-bo&quot; &quot;dev&quot;]
        &quot;prod:build&quot; [&quot;run&quot; &quot;-m&quot; &quot;figwheel.main&quot; &quot;-O&quot; &quot;advanced&quot; &quot;-bo&quot; &quot;prod&quot;]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;  :profiles {:dev {:dependencies [[com.bhauman/figwheel-main &quot;0.2.18&quot;]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;                              [org.slf4j/slf4j-nop &quot;1.7.30&quot;]
                              [com.bhauman/rebel-readline-cljs &quot;0.1.4&quot;]
                              [devcards &quot;0.2.7&quot;]
                              ;; for informing the linter clj-kondo, that the macros
                              ;; defc etc defines symbols
                              [io.github.clj-kondo/config-rum-rum &quot;1.0.0&quot;]]
               :source-paths [&quot;devcards/cljs&quot;]
               :resource-paths [&quot;target&quot;]
               ;; need to add the compiled assets to the :clean-targets
               :clean-targets ^{:protect false} [&quot;target&quot; &quot;resources/public/cljs-out&quot;]
               #_:global-vars #_{*asserts* false}}
         :prod {:dependencies [[com.bhauman/figwheel-main &quot;0.2.18&quot;]]
                :compiler {:optimizations :advanced
                           :pretty-print false}
                :clean-targets ^{:protect false}
                [&quot;target&quot;
                 &quot;resources/public/cljs-out/prod&quot;
                 &quot;resources/public/cljs-out/prod-main.js&quot;]
                :cljsbuild {:builds
                            [{:source-paths [&quot;src/cljs&quot;]
                              :compiler
                              {:output-to &quot;resources/public/cljs-out/prod-main.js&quot;
                               :optimizations :advanced
                               :pretty-print false}
                              :build nil}]}
                :plugins [[lein-cljsbuild &quot;1.1.8&quot;]]}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;  :plugins [[com.github.clj-kondo/lein-clj-kondo &quot;0.2.4&quot;]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        [com.fabiodomingues/lein-clj-depend &quot;0.3.0&quot;] ;; Usage: lein clj-depend
        ;; Detects curcular referencies
        [lein-kibit &quot;0.1.8&quot;] ; Code Analyzer: https://github.com/clj-commons/kibit
                                    ; Anounced better code alternatives
                                    ; Usage: lein kibit
                                    ; Automatic: lein auto kibit
                                    ; With replace: lein kibit --replace --interactive
        ])
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here is the project file of via-trans:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;(defproject via-trans &quot;0.1.0-SNAPSHOT&quot;&lt;br&gt;
  :description &quot;FIXME: write description&quot;&lt;br&gt;
  :url &quot;&lt;a rel=&quot;nofollow&quot; href=&quot;http://example.com/FIXME&quot;&gt;http://example.com/FIXME&lt;/a&gt;&quot;&lt;br&gt;
  :dependencies [;;[camel-snake-kebab &quot;0.4.3&quot;] ; Libray used for converting keywords&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;             [ch.qos.logback/logback-classic &quot;1.4.4&quot;]
             [cljs-ajax &quot;0.8.1&quot;]
             [clj-commons/citrus &quot;3.3.0&quot;]
             ;;[clojure.java-time &quot;1.1.0&quot;]
             ;;[cljc.java-time &quot;RENAMED&quot;]
             [cljc.java-time &quot;0.1.18&quot;]
             [conman &quot;0.9.6&quot;] ; Library used for creating functions from sql
             [cprop &quot;0.1.19&quot;]   ; Configuration
             [devcards &quot;0.2.7&quot;]
             [expound &quot;0.9.0&quot;]
             [funcool/struct &quot;1.4.0&quot;]
             [com.layerware/hugsql &quot;0.5.3&quot;] ; Replacement for conman
             ;[hugsql-adapter-case &quot;0.1.0&quot;] ; case adapter for db table columns 
             [html-ui-lib &quot;0.1.2-SNAPSHOT&quot;]
             [json-html &quot;0.4.7&quot;]
             [luminus-transit &quot;0.1.5&quot;]
             [luminus-undertow &quot;0.1.18&quot;]
             [luminus/ring-ttl-session &quot;0.3.3&quot;]
             [org.mariadb.jdbc/mariadb-java-client &quot;1.1.5&quot;]
             ;;[mysql/mysql-connector-java &quot;8.0.18&quot;]
             [markdown-clj &quot;1.11.3&quot;]
             [metosin/muuntaja &quot;0.6.8&quot;]
             [metosin/reitit &quot;0.5.18&quot;]
             [metosin/ring-http-response &quot;0.9.3&quot;]
             [mount &quot;0.1.16&quot;]
             [nrepl &quot;1.0.0&quot;]
             [org.clojure/clojure &quot;1.11.1&quot;]
             [org.clojure/clojurescript &quot;1.11.60&quot;]
             [org.clojure/tools.cli &quot;1.0.214&quot;]
             [org.clojure/tools.logging &quot;1.2.4&quot;]
             [org.webjars.npm/bulma &quot;0.9.4&quot;]
             [org.webjars.npm/material-icons &quot;1.10.8&quot;]
             [org.webjars/webjars-locator &quot;0.45&quot;]
             [org.webjars/webjars-locator-jboss-vfs &quot;0.1.0&quot;]
             [ring-webjars &quot;0.2.0&quot;]
             [ring/ring-core &quot;1.9.6&quot;]
             [ring/ring-defaults &quot;0.3.4&quot;]
             [rum &quot;0.12.10&quot;]
             [selmer &quot;1.12.55&quot;]]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;  :min-lein-version &quot;2.0.0&quot;&lt;br&gt;
  :source-paths [&quot;src/clj&quot; &quot;src/cljc&quot; &quot;src/cljs&quot; &quot;devcards/cljs&quot;]&lt;br&gt;
  :test-paths [&quot;test/clj&quot; &quot;test/cljc&quot; &quot;test/cljs&quot;]&lt;br&gt;
  :resource-paths [&quot;resources&quot; &quot;target&quot;]&lt;br&gt;
  :clean-targets ^{:protect false} [&quot;target&quot; &quot;resources/public/cljs-out&quot;]&lt;br&gt;
  :target-path &quot;target/%s/&quot;&lt;br&gt;
  :main ^:skip-aot via-trans.core&lt;br&gt;
  :plugins [] &lt;br&gt;
  :profiles&lt;br&gt;
  {:uberjar {:omit-source true&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;         :aot :all
         :uberjar-name &quot;via-trans.jar&quot;
         :source-paths [&quot;env/prod/clj&quot; ]
         :resource-paths [&quot;env/prod/resources&quot;]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   :dev           [:project/dev :profiles/dev]&lt;br&gt;
   :test          [:project/dev :project/test :profiles/test]&lt;br&gt;
   :project/dev  {:jvm-opts [&quot;-Dconf=dev-config.edn&quot; ]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;              :dependencies [[com.bhauman/figwheel-main &quot;0.2.18&quot;]
                             [com.bhauman/rebel-readline-cljs &quot;0.1.4&quot;]
                             [org.clojure/tools.namespace &quot;1.3.0&quot;]
                             [pjstadig/humane-test-output &quot;0.11.0&quot;]
                             [prone &quot;2021-04-23&quot;]
                             [ring/ring-devel &quot;1.9.6&quot;]
                             [ring/ring-mock &quot;0.4.0&quot;]]
              :plugins      [[com.jakemccrary/lein-test-refresh &quot;0.24.1&quot;]
                             [jonase/eastwood &quot;1.2.4&quot;]
                             ;;[cider/cider-nrepl &quot;0.28.4&quot;] ; ist in .lein/profiles.clj
                             ]   
              :source-paths [&quot;env/dev/clj&quot; ]
              :resource-paths [&quot;env/dev/resources&quot; &quot;target&quot;]
              :repl-options {:init-ns user
                             :timeout 120000}
              :injections [(require 'pjstadig.humane-test-output)
                           (pjstadig.humane-test-output/activate!)]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   :project/test {:jvm-opts [&quot;-Dconf=test-config.edn&quot; ]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;              :resource-paths [&quot;env/test/resources&quot;] }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   :profiles/dev {}&lt;br&gt;
   :profiles/test {}})&lt;/p&gt;
&lt;/blockquote&gt;
</description>
<category>Leiningen</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13157/problem-with-leiningen-and-a-local-library</guid>
<pubDate>Sun, 13 Aug 2023 07:35:33 +0000</pubDate>
</item>
<item>
<title>Add requiring-resolve to ClojureScript</title>
<link>https://ask.clojure.org/index.php/13099/add-requiring-resolve-to-clojurescript</link>
<description>&lt;p&gt;I'm not sure if there are any technical hurdles in adding requiring-resolve to ClojureScript, but it would be nice to have parity so REPL utilities can be written using it.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13099/add-requiring-resolve-to-clojurescript</guid>
<pubDate>Tue, 25 Jul 2023 16:49:40 +0000</pubDate>
</item>
<item>
<title>Why doesn't `type` in CLJS check `:type` on its arguments meta like CLJ does?</title>
<link>https://ask.clojure.org/index.php/13095/why-doesnt-type-cljs-check-type-its-arguments-meta-like-does</link>
<description>&lt;p&gt;In CLJ a check for &lt;code&gt;:type&lt;/code&gt; on the meta happens and then falls back to returning the constructor class. In CLJS only the constructor class is returned. It would be nice to have these consistent for usage with multimethods etc. &lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13095/why-doesnt-type-cljs-check-type-its-arguments-meta-like-does</guid>
<pubDate>Sun, 23 Jul 2023 14:56:02 +0000</pubDate>
</item>
<item>
<title>ClojureScript doesn't respect the provided :line and :column meta for functions</title>
<link>https://ask.clojure.org/index.php/13085/clojurescript-doesnt-respect-provided-line-column-functions</link>
<description>&lt;p&gt;There is currently a difference between Clojure and ClojureScript in how the readers handle the provided :line and :column meta for forms.&lt;/p&gt;
&lt;p&gt;In Clojure:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.11.1
user=&amp;gt; ^{:line 40} (defn foo [])
#'user/foo
user=&amp;gt; (-&amp;gt; #'foo meta :line)
40
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;while in ClojureScript:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ClojureScript 1.11.60
cljs.user=&amp;gt; ^{:line 40} (defn foo [])
#'cljs.user/foo
cljs.user=&amp;gt; (-&amp;gt; #'foo meta :line)
1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think this is specially important in ClojureScript where there isn't a way of modifying vars meta.&lt;/p&gt;
&lt;p&gt;Tooling like editors, when sending forms to the repl, can use this mechanism to add for example line information when they know it. Keeping this information is important since other stuff like clojure.repl/source depends on it, which currently breaks as soon as you eval a form from your editor.&lt;/p&gt;
&lt;p&gt;I added a PR here with one possible solution &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojurescript/pull/210&quot;&gt;https://github.com/clojure/clojurescript/pull/210&lt;/a&gt;&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13085/clojurescript-doesnt-respect-provided-line-column-functions</guid>
<pubDate>Fri, 14 Jul 2023 18:03:55 +0000</pubDate>
</item>
<item>
<title>cljs range fn does odd things with nil, is this a bug?</title>
<link>https://ask.clojure.org/index.php/13081/cljs-range-fn-does-odd-things-with-nil-is-this-a-bug</link>
<description>&lt;p&gt;In Clojure, passing a nil as the first arg to range throws NPE, but in ClojureScript it doesn't and odd things can happen:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(range nil 0)
=&amp;gt; ()
(range nil 1)
=&amp;gt; (nil)
(range nil 2)
=&amp;gt; (nil 1)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What's worse is if you have the start and the step both being nil:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(range 0 0 0)
=&amp;gt; ()
(range nil 0 nil)
INTERNAL REPL ERROR: Got an unexpected reply from relay, check Inspect
Timeout while waiting for result.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This actually evaluates to an infinite seq of nils!&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(take 10 (range nil 0 nil))
=&amp;gt; (nil nil nil nil nil nil nil nil nil nil)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;:boom:&lt;/p&gt;
&lt;p&gt;(also raised for discussion on the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1L9DN/p1689260492724489&quot;&gt;clojurians slack&lt;/a&gt;)&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13081/cljs-range-fn-does-odd-things-with-nil-is-this-a-bug</guid>
<pubDate>Thu, 13 Jul 2023 15:24:38 +0000</pubDate>
</item>
<item>
<title>Should documentation be added to explain the default browser console representation of CLJS collections and seqs?</title>
<link>https://ask.clojure.org/index.php/12932/documentation-explain-default-representation-collections</link>
<description>&lt;p&gt;Using &lt;code&gt;console.log&lt;/code&gt; on a CLJS collection or sequence returns an internal representation of the object that looks like &lt;code&gt;`&lt;/code&gt;Object { meta: null, cnt: 3, shift: 5, root: {…}, tail: (3) […], __hash: null, &quot;cljs$lang$protocol_mask$partition0$&quot;: 167666463, &quot;cljs$lang$protocol_mask$partition1$&quot;: 139268 }&lt;code&gt;`&lt;/code&gt;. This seems like an easy pitfall for a beginner since &lt;code&gt;console.log&lt;/code&gt; is a standard debugging tool for JS developers. Referring users to something like &lt;code&gt;binaryage/devtools&lt;/code&gt; or any of the built-in functions for converting CLJS types to JS types might be helpful.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12932/documentation-explain-default-representation-collections</guid>
<pubDate>Thu, 11 May 2023 16:04:18 +0000</pubDate>
</item>
<item>
<title>Why does this work in CLJS but doesn't in JVM Clojure?</title>
<link>https://ask.clojure.org/index.php/12903/why-does-this-work-in-cljs-but-doesnt-in-jvm-clojure</link>
<description>&lt;p&gt;This looks like a bug in ClojureScript 1.11.54 :&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(conj {} [:a 1] '([:b 2] [:c 3]) '([:d 4]))&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In Clojure on the JVM this is an error:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cljs.user&amp;gt; (conj {} [:a 1] '([:b 2] [:c 3]) '([:d 4]))
{:a 1, :b 2, :c 3, :d 4}
cljs.user&amp;gt; :cljs/quit
nil
user&amp;gt; (conj {} [:a 1] '([:b 2] [:c 3]) '([:d 4]))
Execution error (ClassCastException) at user/eval17754 (REPL:25).
class clojure.lang.PersistentVector cannot be cast to class java.util.Map$Entry (clojure.lang.PersistentVector is in unnamed module of loader 'app'; java.util.Map$Entry is in module java.base of loader 'bootstrap')
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12903/why-does-this-work-in-cljs-but-doesnt-in-jvm-clojure</guid>
<pubDate>Thu, 27 Apr 2023 19:12:03 +0000</pubDate>
</item>
<item>
<title>`specify!` and `set!` silently fail if object is not extensible</title>
<link>https://ask.clojure.org/index.php/12898/specify-and-set-silently-fail-if-object-is-not-extensible</link>
<description>&lt;p&gt;&lt;code&gt;specify!&lt;/code&gt; implicitly relies on the provided object to be extensible so that protocol implementations can be provided. Here is a quick demonstration from a REPL.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cljs.user&amp;gt; (def obj #js {:current nil})
[#js {:current nil}]
cljs.user&amp;gt; (js/Object.preventExtensions obj)
{&quot;current&quot; nil}
cljs.user&amp;gt; (specify! obj
              IDeref
              (-deref [^js this] (.-current this)))
{&quot;current&quot; nil}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that &lt;code&gt;reify&lt;/code&gt; does not document this requirement either. This leads to confusing situations where non-extensible objects returned by JavaScript libraries (e.g. React) are unable to be extended and the user has little clue why.&lt;/p&gt;
&lt;p&gt;Similarly, &lt;code&gt;set!&lt;/code&gt; silently fails when objects are not extensible.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cljs.user&amp;gt; (set! (.-foo obj) &quot;bar&quot;)
&quot;bar&quot;
cljs.user&amp;gt; obj
{&quot;current&quot; nil}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;goog.object/set&lt;/code&gt; is able to detect this and throw an error.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cljs.user&amp;gt; (goog.object/set obj &quot;foo&quot; &quot;bar&quot;)    
Execution error (TypeError) at (&amp;lt;cljs repl&amp;gt;:1).
Cannot add property foo, object is not extensible
:repl/exception!
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12898/specify-and-set-silently-fail-if-object-is-not-extensible</guid>
<pubDate>Mon, 24 Apr 2023 01:11:19 +0000</pubDate>
</item>
<item>
<title>Firefox addon written in cljs can't pass Mozilla's review</title>
<link>https://ask.clojure.org/index.php/12821/firefox-addon-written-in-cljs-cant-pass-mozillas-review</link>
<description>&lt;p&gt;Hi everyone,&lt;br&gt;
I have a Firefox addon written cljs with advanced optimization, after submit to addons, the reviews tell me that the zip file I submit is different from what they built from source.&lt;/p&gt;
&lt;p&gt;I use diff-so-fancy to compare the generated js file, and I found the main difference are variable names.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/3848910/228865742-373cf850-4783-49a3-afc1-290245ce99d2.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;So is there any way to ensure generated js are reproducible?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;PS: My project source code is here:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/jiacai2050/gooreplacer/blob/firefox/cljs-src/project.clj#L76&quot;&gt;https://github.com/jiacai2050/gooreplacer/blob/firefox/cljs-src/project.clj#L76&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12821/firefox-addon-written-in-cljs-cant-pass-mozillas-review</guid>
<pubDate>Thu, 30 Mar 2023 14:16:58 +0000</pubDate>
</item>
<item>
<title>Feature request: async/await support in CLJS</title>
<link>https://ask.clojure.org/index.php/12806/feature-request-async-await-support-in-cljs</link>
<description>&lt;p&gt;There is a lot of discussion around the web related to adding ES2018 async/await to ClojureScript, be it feature requests[1][2], proposals[3], or experimentation[4][5].&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;I am posting this question so there is a central place where people can upvote and bring attention to the Clojure core team, and possibly help prioritize consideration of this feature.&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;I am aware it is not as easy as adding keywords to emitted JS code. I am aware of workarounds like using macros from promesa, core.async, or kitchen-async. I am also aware that there must be a strong use case for consideration on adding this feature. Everything I've mentioned, and more, has been discussed at one point in the links below.&lt;/p&gt;
&lt;p&gt;[1] &lt;a rel=&quot;nofollow&quot; href=&quot;https://groups.google.com/g/clojurescript/c/scUMhU-ctEM&quot;&gt;https://groups.google.com/g/clojurescript/c/scUMhU-ctEM&lt;/a&gt;&lt;br&gt;
[2] &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.reddit.com/r/Clojure/comments/f4nlau/clojurescript_and_asyncawait/&quot;&gt;https://www.reddit.com/r/Clojure/comments/f4nlau/clojurescript_and_asyncawait/&lt;/a&gt;&lt;br&gt;
[3] &lt;a rel=&quot;nofollow&quot; href=&quot;https://observablehq.com/@shaunlebron/proposal-generators-and-async-functions-in-clojurescript#blockers&quot;&gt;https://observablehq.com/@shaunlebron/proposal-generators-and-async-functions-in-clojurescript#blockers&lt;/a&gt;&lt;br&gt;
[4] &lt;a rel=&quot;nofollow&quot; href=&quot;https://twitter.com/roman01la/status/1155602189311717377&quot;&gt;https://twitter.com/roman01la/status/1155602189311717377&lt;/a&gt;&lt;br&gt;
[5] &lt;a rel=&quot;nofollow&quot; href=&quot;https://twitter.com/borkdude/status/1639579880336621570&quot;&gt;https://twitter.com/borkdude/status/1639579880336621570&lt;/a&gt;&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12806/feature-request-async-await-support-in-cljs</guid>
<pubDate>Mon, 27 Mar 2023 23:57:27 +0000</pubDate>
</item>
<item>
<title>Feature request: option to demunge keys in `js-&gt;clj` function</title>
<link>https://ask.clojure.org/index.php/12642/feature-request-option-to-demunge-keys-in-js-clj-function</link>
<description>&lt;p&gt;I'm dealing with JSON data that always uses snake case. While it is possible to achieve what I want with clojure.walk, I think it would be convenient to add an option to &lt;code&gt;js-&amp;gt;clj&lt;/code&gt; to not only keywordize keys, but also demunge them, so that &lt;code&gt;&quot;some_key&quot;&lt;/code&gt; becomes &lt;code&gt;:some-key&lt;/code&gt;.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12642/feature-request-option-to-demunge-keys-in-js-clj-function</guid>
<pubDate>Sun, 05 Feb 2023 00:11:40 +0000</pubDate>
</item>
<item>
<title>cljs.js/eval: def not working when using :simple optimization (works with :none/:whitespace)</title>
<link>https://ask.clojure.org/index.php/12512/cljs-eval-working-using-simple-optimization-works-whitespace</link>
<description>&lt;p&gt;as the title suggests, def appears to pass through without doing anything.&lt;/p&gt;
&lt;p&gt;i.e. &quot;(def x)&quot; succeeds&lt;br&gt;
but &quot;(def x 10)&quot; fails because&lt;br&gt;
&quot;Cannot read properties of undefined (reading 'x')&quot;&lt;/p&gt;
&lt;p&gt;article here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurescript.org/guides/self-hosting&quot;&gt;https://clojurescript.org/guides/self-hosting&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;suggests :simple optimization should work&lt;/p&gt;
&lt;p&gt;to reproduce: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/sstraust/ClojureDefRepro&quot;&gt;https://github.com/sstraust/ClojureDefRepro&lt;/a&gt; (see comments for instructions)&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12512/cljs-eval-working-using-simple-optimization-works-whitespace</guid>
<pubDate>Wed, 28 Dec 2022 15:51:59 +0000</pubDate>
</item>
<item>
<title>clojurescript cljs.main -t node compilation in recent releases does not create an `out` dir</title>
<link>https://ask.clojure.org/index.php/12335/clojurescript-cljs-main-compilation-recent-releases-create</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;it appears as if there is a regression since cljs 1.10.748+ that when a node compilation is requested without explicitly specifying the outdir,  a &lt;code&gt;.cljs_node_repl&lt;/code&gt; directory is created as the output dir instead of &lt;code&gt;out&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;The default out compilation directory is not mentioned in &lt;code&gt;cljs.main -h&lt;/code&gt; help, but it appears to be &lt;code&gt;out&lt;/code&gt; by default, and this is backed by statement at the end of &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurescript.org/reference/repl-and-main&quot;&gt;https://clojurescript.org/reference/repl-and-main&lt;/a&gt; :&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Compiling Source&lt;/p&gt;
&lt;p&gt;To compile ClojureScript source code, pass the main namespace to&lt;br&gt;
cljs.main via the -c option:&lt;/p&gt;
&lt;p&gt;java -cp src:cljs.jar cljs.main -c my-namespace.core&lt;/p&gt;
&lt;p&gt;The output will be written to the directory specified via the -d&lt;br&gt;
option (or out if unspecified), or to the file specified via the -o&lt;br&gt;
option.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To reproduce&lt;br&gt;
1. download both clojurescript 1.10.742 and clojuresript 1.10.748 jars, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojurescript/releases&quot;&gt;https://github.com/clojure/clojurescript/releases&lt;/a&gt;&lt;br&gt;
2. create the getting started hello world program from &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurescript.org/guides/quick-start&quot;&gt;https://clojurescript.org/guides/quick-start&lt;/a&gt;&lt;br&gt;
3. execute &lt;code&gt;java -cp &quot;src;cljs-1.10.748.jar&quot; cljs.main -t node -c hello-world.core&lt;/code&gt;, observe that a &lt;code&gt;.cljs_node_repl&lt;/code&gt; directory has been created instead of the excpected &lt;code&gt;out&lt;/code&gt; dir.&lt;/p&gt;
&lt;p&gt;If one runs the same with and earlier version, e.g. &lt;code&gt;java -cp &quot;src;cljs-1.10.742.jar&quot; cljs.main -t node -c hello-world.core&lt;/code&gt; they can observe that an &lt;code&gt;out&lt;/code&gt; dir is created as expected.&lt;/p&gt;
&lt;p&gt;This looks like a regression to me.&lt;/p&gt;
&lt;p&gt;Workaround is to explicitly specify the directory, .e.g. &lt;code&gt;java -cp &quot;src;cljs-1.11.60.jar&quot; cljs.main -t node -d out -c hello-world.core&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12335/clojurescript-cljs-main-compilation-recent-releases-create</guid>
<pubDate>Thu, 27 Oct 2022 18:07:40 +0000</pubDate>
</item>
<item>
<title>How do i install Clojure on my Windows OS Laptop?</title>
<link>https://ask.clojure.org/index.php/12283/how-do-i-install-clojure-on-my-windows-os-laptop</link>
<description>&lt;p&gt;I need help on how to install and use my Clojure on my Windows Operating system.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12283/how-do-i-install-clojure-on-my-windows-os-laptop</guid>
<pubDate>Tue, 04 Oct 2022 23:04:29 +0000</pubDate>
</item>
<item>
<title>Why does CLJS behave differently inside and outside of a function when using &gt; to compare strings?</title>
<link>https://ask.clojure.org/index.php/12186/behave-differently-inside-outside-function-compare-strings</link>
<description>&lt;p&gt;When building a custom comparator function in CLJS I encountered some IMO strange behaviour: &lt;/p&gt;
&lt;p&gt;When using the &amp;gt; (or similar) function with two strings directly in the REPL I get an :invalid-arithmetic warning and nil is returned (somewhat similar to CLJ that raises an exception). When I do the same inside a function it will return a boolean with no warning at all (CLJ raises an exception)&lt;/p&gt;
&lt;p&gt;CLJS:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj꞉user꞉&amp;gt; (&amp;gt; &quot;A&quot; &quot;Z&quot;)
nil
; ------ WARNING - :invalid-arithmetic -------------------------------------------
;  Resource: &amp;lt;eval&amp;gt;:1:1
 cljs.core/&amp;gt;, all arguments must be numbers, got [string string] instead
--------------------------------------------------------------------------------

clj꞉user꞉&amp;gt; ((fn [x y] (&amp;gt; x y)) &quot;A&quot; &quot;Z&quot;)
false
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;CLJ:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (&amp;gt; &quot;A&quot; &quot;Z&quot;)
Execution error (ClassCastException) at user/eval3 (REPL:1).
class java.lang.String cannot be cast to class java.lang.Number (java.lang.String and java.lang.Number are in module java.base of loader 'bootstrap')
user=&amp;gt; ((fn [x y] (&amp;gt; x y)) &quot;A&quot; &quot;Z&quot;)
Execution error (ClassCastException) at user/eval5$fn (REPL:1).
class java.lang.String cannot be cast to class java.lang.Number (java.lang.String and java.lang.Number are in module java.base of loader 'bootstrap')
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Can anyone explain what is going on?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br&gt;
Julian&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12186/behave-differently-inside-outside-function-compare-strings</guid>
<pubDate>Fri, 09 Sep 2022 14:53:04 +0000</pubDate>
</item>
<item>
<title>Could there be a ClojureScript version of core.cache?</title>
<link>https://ask.clojure.org/index.php/12143/could-there-be-a-clojurescript-version-of-core-cache</link>
<description>&lt;p&gt;CCACHE-42 &quot;Porting core.cache to ClojureScript&quot; was declined for infeasibility in 2018, but the JavaScript situation has improved since then.  WeakRef has spread to all MDN-tracked environments except Opera.&lt;/p&gt;
&lt;p&gt;Lack of a ClojureScript port of data.priority-map (used by 2 cache types) is another challenge noted by CCACHE-42.  An issue for a cljc port of data.priority-map is currently open: DPRIMAP-8.&lt;/p&gt;
&lt;p&gt;As more data processing moves into browsers and Node.js, core.cache is one of the rare Clojure gems that is still pinned to the JVM.  &lt;/p&gt;
&lt;p&gt;Since a cljc port of core.cache is not as infeasible as it used to be (and to formalize an interest in DPRIMAP-8), may we reopen CCACHE-42?&lt;/p&gt;
</description>
<category>core.cache</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12143/could-there-be-a-clojurescript-version-of-core-cache</guid>
<pubDate>Sun, 04 Sep 2022 11:54:10 +0000</pubDate>
</item>
<item>
<title>Can't change the HTML DOM</title>
<link>https://ask.clojure.org/index.php/12141/cant-change-the-html-dom</link>
<description>&lt;p&gt;It is happening when I'm learning Web Development with Clojure, Third Edition. At first everything looks fine and nothing to worry about, but when i start turn on my pc again, move into next section, and change the code, the HTML layout doesn't change. It's still &quot;Hello, Auto!&quot; even i restore the code again.&lt;/p&gt;
&lt;p&gt;I even do with the backup project, but the output still same.&lt;/p&gt;
&lt;p&gt;Here's the code :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns guestbook.core)

(-&amp;gt; (.getElementById js/document &quot;content&quot;)
    (.-innerHTML)
    (set! &quot;Hello, Auto!&quot;))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and this is the home HTML resources :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{% extends &quot;base.html&quot; %}
{% block content %}
&amp;lt;input id=&quot;token&quot; type=&quot;hidden&quot; value=&quot;{{csrf-token}}&quot; /&amp;gt;
&amp;lt;div id=&quot;content&quot;&amp;gt;&amp;lt;/div&amp;gt;
{% endblock %}
{% block page-scripts %}
    {% script &quot;/js/app.js&quot; %}
{% endblock %}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12141/cant-change-the-html-dom</guid>
<pubDate>Fri, 02 Sep 2022 09:55:18 +0000</pubDate>
</item>
<item>
<title>ClojureScript can't handle/catch exceptions from neodoc</title>
<link>https://ask.clojure.org/index.php/12062/clojurescript-cant-handle-catch-exceptions-from-neodoc</link>
<description>&lt;p&gt;The errors thrown by neodoc npm module cause issues for ClojureScript (but not node).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ java -cp cljs.jar cljs.main --repl-env node
ClojureScript 1.10.758
cljs.user=&amp;gt; (def neodoc (js/require &quot;neodoc&quot;))
#'cljs.user/neodoc
cljs.user=&amp;gt;  (.run neodoc &quot;Usage:\n  foo&quot; (clj-&amp;gt;js {:argv []}))                    
#js {}

cljs.user=&amp;gt;  (.run neodoc &quot;Usage:\n  foo&quot; (clj-&amp;gt;js {:argv [&quot;bar&quot;] :dontExit true}))
Execution error () at (&amp;lt;cljs repl&amp;gt;:1).
null

cljs.user=&amp;gt; (try (.run neodoc &quot;Usage:\n  foo&quot; (clj-&amp;gt;js {:argv [&quot;bar&quot;] :dontExit true})) (catch :default e (prn :e e)))
Execution error (TypeError) at (&amp;lt;cljs repl&amp;gt;:1).
Function.prototype.toString requires that 'this' be a Function
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This works in node (albeit the thrown object is strange):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Welcome to Node.js v16.13.2.
Type &quot;.help&quot; for more information.
&amp;gt; neodoc = require(&quot;neodoc&quot;)
{
  run: [Function: run],
  parse: [Function: parse],
  default: { run: [Function: run], parse: [Function: parse] }
}
&amp;gt; neodoc.run(&quot;Usage:\n  foo&quot;, {argv: [&quot;bar&quot;], dontExit: true})
Uncaught:
Function {
  message: 'foo: unknown command bar\n' +
    'Usage:\n' +
    '  foo\n' +
    'See foo -h/--help for more information',
  payload: {}
}
&amp;gt; try { neodoc.run(&quot;Usage:\n  foo&quot;, {argv: [&quot;bar&quot;], dontExit: true}) } catch (e) { console.log(&quot;e:&quot;, e) }
e: Function {
  message: 'foo: unknown command bar\n' +
    'Usage:\n' +
    '  foo\n' +
    'See foo -h/--help for more information',
  payload: {}
}
undefined
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12062/clojurescript-cant-handle-catch-exceptions-from-neodoc</guid>
<pubDate>Thu, 21 Jul 2022 22:40:23 +0000</pubDate>
</item>
<item>
<title>Calva project type: shadow-cljs vs deps.edn + shadow-cljs?</title>
<link>https://ask.clojure.org/index.php/11901/calva-project-type-shadow-cljs-vs-deps-edn-shadow-cljs</link>
<description>&lt;p&gt;Hi everyone, I’ve gone through the shadow-cljs quickstart guide in the GitHub repo README and got the desired message in the browser console. Next, I wanted to introduce &lt;code&gt;deps.edn&lt;/code&gt; to the project. I had some (self-inflicted) difficulty in jacking in after adding  &lt;code&gt;deps.edn&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;System details:&lt;br&gt;
OS: WSL2&lt;br&gt;
Java version: OpenJDK 11.0.15&lt;br&gt;
Clojure CLI version: 1.11.1.1113&lt;/p&gt;
&lt;p&gt;With only &lt;code&gt;shadow-cljs.edn&lt;/code&gt; in the project, said file contents are:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; shadow-cljs.edn
{:source-paths [&quot;src/dev&quot;
                &quot;src/main&quot;
                &quot;src/test&quot;]
 :dependencies []
 
 :dev-http {8080 &quot;public&quot;}
 :builds {:frontend {:target :browser
                     :modules {:main {:init-fn acme.frontend.app/init}}}}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At this point, jacking in with Calva using the “shadow-cljs” project type, which both starts and connects to the “:frontend” build, works like a charm. &lt;/p&gt;
&lt;p&gt;As mentioned in the first paragraph, I had difficulty with introducing &lt;code&gt;deps.edn&lt;/code&gt; to the project.&lt;/p&gt;
&lt;p&gt;Add &lt;code&gt;deps.edn&lt;/code&gt; to the main project directory with the following contents:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; deps.edn
{:paths [&quot;src/main&quot;
&quot;src/dev&quot;
&quot;src/test&quot;]

 :aliases
 {:cljs {:extra-deps {thheller/shadow-cljs {:mvn/version &quot;2.19.0&quot;}}}}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change &lt;code&gt;shadow-cljs.edn&lt;/code&gt; to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; ;; shadow-cljs.edn
    
 {:deps {:aliases [:cljs]}
        
:dev-http {8080 &quot;public&quot;}
        
:builds {:frontend {:target :browser
:modules {:main {:init-fn acme.frontend.app/init}}}}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Jacking in with Calva using the “deps.edn + shadow-cljs” project type at this point leads to an error containing “Failed starting cljs repl for build: :frontend. Is the build running and connected?” &lt;/p&gt;
&lt;p&gt;The Calva Connection Log also provides information, including: “shadow-cljs has not been started yet!” and “If you have a shadow-cljs server or watch running then you are not connected to that process.”&lt;/p&gt;
&lt;p&gt;The build doesn’t seem to have been started. What if we run &lt;code&gt;npx shadow-cljs watch frontend&lt;/code&gt; and then tried connecting to the REPL? Same error messages as before.&lt;/p&gt;
&lt;p&gt;It turns out I should’ve instead kept using the “shadow-cljs” project type (in which case the addition of &lt;code&gt;deps.edn&lt;/code&gt; goes down without a hitch).&lt;/p&gt;
&lt;p&gt;This leads me to wonder:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When to use which project type?  &lt;/li&gt;
&lt;li&gt;Which is preferred for a fullstack&lt;br&gt;
project?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thanks to Peter and contributors for Calva!&lt;/p&gt;
</description>
<category>Tools</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11901/calva-project-type-shadow-cljs-vs-deps-edn-shadow-cljs</guid>
<pubDate>Sat, 21 May 2022 19:46:14 +0000</pubDate>
</item>
<item>
<title>lein fig:build doesn't react on any changes in &quot;src&quot; dir</title>
<link>https://ask.clojure.org/index.php/11780/lein-fig-build-doesnt-react-on-any-changes-in-src-dir</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;when I run &lt;code&gt;lein fig:build&lt;/code&gt; it prints diagnostics like:&lt;br&gt;
&lt;code&gt;[Figwheel] Watching paths: (&quot;test&quot; &quot;src&quot; &quot;src/mypkg&quot;) to compile build - dev&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;But it really doesn't, when I change something in &lt;code&gt;src&lt;/code&gt;, it just stays silent, nothing changes in browser also. Irun it in WSL2 and I guess it might be reated to it, because npm builds with watch functionality also didn't do actual watching. Only solution I found is &lt;a rel=&quot;nofollow&quot; href=&quot;https://ma.rcbla.se/blog/2020/08/gulp-watch-not-firing-with-changed-files-when-run-in-wsl/&quot;&gt;https://ma.rcbla.se/blog/2020/08/gulp-watch-not-firing-with-changed-files-when-run-in-wsl/&lt;/a&gt;&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11780/lein-fig-build-doesnt-react-on-any-changes-in-src-dir</guid>
<pubDate>Mon, 18 Apr 2022 21:46:11 +0000</pubDate>
</item>
</channel>
</rss>