<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged jira</title>
<link>https://ask.clojure.org/index.php/tag/jira</link>
<description></description>
<item>
<title>Improving curl options for CLI install scripts (brew-install)</title>
<link>https://ask.clojure.org/index.php/14900/improving-curl-options-for-cli-install-scripts-brew-install</link>
<description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;I'm the maintainer for Heroku's Clojure buildpack. It uses the install scripts from clojure/brew-install to install the CLI. I noticed intermittent install failures related to the download of the Clojure tools. I believe most of them could be avoided with a slightly changed curl command line options.&lt;/p&gt;
&lt;p&gt;I opened a PR before realizing that PRs will not be accepted, so I'm starting this thread to properly get the discussion going. For reference, the closed PR can be found here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/brew-install/pull/10&quot;&gt;https://github.com/clojure/brew-install/pull/10&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I believe these options would improve the download behaviour for all users, but especially when used in automations:&lt;/p&gt;
&lt;p&gt;--connect-timeout 3 (&lt;a rel=&quot;nofollow&quot; href=&quot;https://curl.se/docs/manpage.html#--connect-timeout&quot;&gt;https://curl.se/docs/manpage.html#--connect-timeout&lt;/a&gt;)&lt;br&gt;
Prevents hanging when server is unreachable.&lt;/p&gt;
&lt;p&gt;--fail (&lt;a rel=&quot;nofollow&quot; href=&quot;https://curl.se/docs/manpage.html#-f&quot;&gt;https://curl.se/docs/manpage.html#-f&lt;/a&gt;)&lt;br&gt;
Exit with error code 22 for HTTP responses with status codes &amp;gt;= 400.&lt;/p&gt;
&lt;p&gt;--max-time 60 (&lt;a rel=&quot;nofollow&quot; href=&quot;https://curl.se/docs/manpage.html#-m&quot;&gt;https://curl.se/docs/manpage.html#-m&lt;/a&gt;)&lt;br&gt;
Maximum time in seconds for the entire transfer operation. Prevents hanging indefinitely with slow connections.&lt;/p&gt;
&lt;p&gt;--no-progress-meter (&lt;a rel=&quot;nofollow&quot; href=&quot;https://curl.se/docs/manpage.html#--no-progress-meter&quot;&gt;https://curl.se/docs/manpage.html#--no-progress-meter&lt;/a&gt;)&lt;br&gt;
Introduced in curl 7.67.0 (Nov 2019). Disables the progress bar for cleaner output. But less drastic than --silent and will still output diagnostic information (i.e. retries).&lt;/p&gt;
&lt;p&gt;--retry-max-time 60 (&lt;a rel=&quot;nofollow&quot; href=&quot;https://curl.se/docs/manpage.html#--retry-max-time&quot;&gt;https://curl.se/docs/manpage.html#--retry-max-time&lt;/a&gt;)&lt;br&gt;
Retry only within this time period (60 seconds). After this time expires, no more retries will be attempted.&lt;/p&gt;
&lt;p&gt;--retry 5 (&lt;a rel=&quot;nofollow&quot; href=&quot;https://curl.se/docs/manpage.html#--retry&quot;&gt;https://curl.se/docs/manpage.html#--retry&lt;/a&gt;)&lt;br&gt;
Introduced in curl 7.12.3 (Dec 2004). Retry up to 5 times on transient errors (timeouts, HTTP 408, 429, 500, 502, 503, 504, 522, 524).&lt;/p&gt;
&lt;p&gt;--retry-connrefused (&lt;a rel=&quot;nofollow&quot; href=&quot;https://curl.se/docs/manpage.html#--retry-connrefused&quot;&gt;https://curl.se/docs/manpage.html#--retry-connrefused&lt;/a&gt;)&lt;br&gt;
Introduced in curl 7.52.0 (Dec 2016). Consider connection refused as a transient error for --retry.&lt;/p&gt;
&lt;p&gt;These are obviously opinionated and my ask is not for these options specifically. Happy to get anything that will improve the situation. :)&lt;/p&gt;
&lt;p&gt;Manuel&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14900/improving-curl-options-for-cli-install-scripts-brew-install</guid>
<pubDate>Mon, 26 Jan 2026 12:39:44 +0000</pubDate>
</item>
<item>
<title>clojure.edn and clojure allows keywords with empty (&quot;&quot;) namespaces</title>
<link>https://ask.clojure.org/index.php/14811/clojure-edn-clojure-allows-keywords-with-empty-namespaces</link>
<description>&lt;p&gt;Following links and snippets are about clojure.edn but because this logic is the same in clojure it also affects clojure reader as well.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java#L28&quot;&gt;Here&lt;/a&gt; is how symbol pattern is defined:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[:]?([\D&amp;amp;&amp;amp;[^/]].*/)?(/|[\D&amp;amp;&amp;amp;[^/]][^/]*)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is eagerly matching prefix until &lt;strong&gt;the last&lt;/strong&gt; slash character, after that it matches symbol name.&lt;/p&gt;
&lt;p&gt;Then &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java#L289-L311&quot;&gt;there&lt;/a&gt; is a wrong analysis of matched groups happen: ns is incorrectly set to everything until the last slash with &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java#L296&quot;&gt;validation&lt;/a&gt; that it is not ends with :/&lt;/p&gt;
&lt;p&gt;Then in Symbol.intern call there is an another lookup for &lt;strong&gt;the first&lt;/strong&gt; slash to split symbol into namespace and name.&lt;/p&gt;
&lt;p&gt;The result is that keywords like this: &quot;:/-/-&quot;, end up with namespace set to empty string &quot;&quot;.&lt;/p&gt;
&lt;p&gt;Looks like the least intrusive way to fix it is to use the same logic to find namespace borders in both places:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;during symbol reading, lookup the first / to set ns instead of using the first matching group&lt;/li&gt;
&lt;li&gt;in symbol interning the logic is correct&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Another option is to use different regular expression: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[:]?([\D&amp;amp;&amp;amp;[^/]][^/]*/)?(/|[\D&amp;amp;&amp;amp;[^/]].*[^/])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This matches symbol prefix til &lt;strong&gt;the first&lt;/strong&gt; slash keeping restriction &quot;name can't end with slash&quot;.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14811/clojure-edn-clojure-allows-keywords-with-empty-namespaces</guid>
<pubDate>Fri, 05 Dec 2025 09:56:54 +0000</pubDate>
</item>
<item>
<title>bug   bigdec</title>
<link>https://ask.clojure.org/index.php/14809/bug-bigdec</link>
<description>&lt;p&gt;&lt;img src=&quot;https://mysys-images.oss-cn-beijing.aliyuncs.com/clojure-bigdec.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14809/bug-bigdec</guid>
<pubDate>Fri, 05 Dec 2025 05:09:44 +0000</pubDate>
</item>
<item>
<title>[clojure.edn] Leading zeros in numbers</title>
<link>https://ask.clojure.org/index.php/14798/clojure-edn-leading-zeros-in-numbers</link>
<description>&lt;p&gt;clojure.edn allow leading zeros ending up reading such number as octal representation. The problem is that it is also allowed to have indefinite amount of leading zeros for octals:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;000000000000042  ;; =&amp;gt; 34
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and when there is a suffix &quot;M&quot; that forces floating point representation the same string become float 42 stripping all leading zeros.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;000000000000042M ;; =&amp;gt; 42M
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At the same time EDN specification forbids integers with leading zeros at all even for floats.&lt;br&gt;
I found a ticket about leading zeros in data.json but I think it should be expanded to cover clojure as well.&lt;/p&gt;
&lt;p&gt;In the same scope but origin is in the EDN spec:&lt;br&gt;
float specification allows leading zeroes in exponent and only zeros in fractional parts:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0.00000000...00
0.0e0001
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;probably because of that clojure.edn read such numbers without error too. &lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14798/clojure-edn-leading-zeros-in-numbers</guid>
<pubDate>Thu, 04 Dec 2025 13:31:23 +0000</pubDate>
</item>
<item>
<title>Could we get deref support on ScopedValue?</title>
<link>https://ask.clojure.org/index.php/14771/could-we-get-deref-support-on-scopedvalue</link>
<description>&lt;p&gt;Following on from &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/14767/multiple-cannot-idiomatically-leveraged-proper-ideref-support&quot;&gt;this&lt;/a&gt;, and since &lt;code&gt;Optional&lt;/code&gt; is already being considered, I would like to propose that &lt;code&gt;ScopedValue&lt;/code&gt; is considered as well. It is now a standard feature on an LTS release (i.e. 25).&lt;/p&gt;
&lt;p&gt;As always, thanks in advance...&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14771/could-we-get-deref-support-on-scopedvalue</guid>
<pubDate>Tue, 25 Nov 2025 16:26:47 +0000</pubDate>
</item>
<item>
<title>Inconsistent errors in ratio parsing with either `clojure.edn/read` or `clojure.core/read`</title>
<link>https://ask.clojure.org/index.php/14763/inconsistent-errors-ratio-parsing-either-clojure-clojure</link>
<description>&lt;pre&gt;&lt;code&gt;user=&amp;gt; (clojure.edn/read-string &quot;777/2&quot;) ;; no surprises
777/2
user=&amp;gt; (clojure.edn/read-string &quot;0777/2&quot;) ;; wait, 0777 supposed to be 511
777/2
user=&amp;gt; (clojure.edn/read-string &quot;0x777/2&quot;) ;; hexadecimal suddenly throws
Execution error (NumberFormatException) at user/eval175 (REPL:1).
Invalid number: 0x777/2
user=&amp;gt; (clojure.edn/read-string &quot;32r777/2&quot;) ;; radix throws as well
Execution error (NumberFormatException) at user/eval177 (REPL:1).
Invalid number: 32r777/2
user=&amp;gt; (clojure.edn/read-string &quot;777N/2&quot;) ;; same for BigInt
Execution error (NumberFormatException) at user/eval181 (REPL:1).
Invalid number: 777N/2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Inconsistent part here is octal integer numerator form. I would expect it to fail the same way as the rest of this list but not to silently drop leading zero and turn to not octal form at all.&lt;/p&gt;
&lt;p&gt;Second part of the question is: Why other forms throws at all?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14763/inconsistent-errors-ratio-parsing-either-clojure-clojure</guid>
<pubDate>Sat, 22 Nov 2025 17:12:47 +0000</pubDate>
</item>
<item>
<title>Docstring clojure.edn/read-string is misleading</title>
<link>https://ask.clojure.org/index.php/14762/docstring-clojure-edn-read-string-is-misleading</link>
<description>&lt;blockquote&gt;&lt;p&gt;  user=&amp;gt; (doc clojure.edn/read-string)&lt;br&gt;
  -------------------------&lt;br&gt;
  clojure.edn/read-string&lt;br&gt;
  ([s] [opts s])&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Reads one object from the string s. Returns nil when s is nil or empty.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   Reads data in the edn format (subset of Clojure data):&lt;br&gt;
   &lt;a rel=&quot;nofollow&quot; href=&quot;http://edn-format.org&quot;&gt;http://edn-format.org&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;   opts is a map as per clojure.edn/read&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note &lt;strong&gt;Returns nil when s is nil or empty.&lt;/strong&gt;. But when called with opts without explicit :eof it throws EOF error&lt;/p&gt;
&lt;p&gt;user=&amp;gt; (clojure.edn/read-string {} &quot;&quot;)&lt;br&gt;
Execution error at user/eval222 (REPL:1).&lt;br&gt;
EOF while reading&lt;/p&gt;
&lt;p&gt;And without options it returns nil as expected&lt;/p&gt;
&lt;p&gt;user=&amp;gt; (clojure.edn/read-string &quot;&quot;)&lt;br&gt;
nil&lt;/p&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14762/docstring-clojure-edn-read-string-is-misleading</guid>
<pubDate>Thu, 20 Nov 2025 15:10:38 +0000</pubDate>
</item>
<item>
<title>clojure.edn/read invoke user-supplied reader functions when tagged literal is to be discarded by discard macro</title>
<link>https://ask.clojure.org/index.php/14761/clojure-supplied-functions-tagged-literal-discarded-discard</link>
<description>&lt;p&gt;According to edn-format/edn specification &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;A reader should not call user-supplied tag handlers during the processing of the element to be discarded.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;But with clojure.edn/read and its derivatives execute provided reader functions under discard tag:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (clojure.edn/read-string {:readers {'foo (fn [val] (prn &quot;!!!&quot;) val)}} &quot;#_ #foo [1 2 3]&quot;)
&quot;!!!&quot;
Execution error at user/eval216 (REPL:1).
EOF while reading
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same happen with clojure.core/read and its derivatives:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (binding [*data-readers* {'foo (fn [val] (prn &quot;!!!&quot;) val)}] (read-string &quot;#_ #foo [1 2 3]&quot;))
&quot;!!!&quot;
Execution error at user/eval146 (REPL:1).
EOF while reading
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I understand that Clojure' reader does not provide explicit description of what is executed during reading out form to be discarded except &quot;The form following #_ is completely skipped by the reader.&quot; but I think it is worth to mention that here.&lt;/p&gt;
&lt;p&gt;After realisation that this post is not qualifies as &quot;ask&quot;&lt;/p&gt;
&lt;p&gt;To summarize:&lt;br&gt;
Is this a bug in clojure edn specification implementation?&lt;br&gt;
Is the edn specification no longer accurate?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14761/clojure-supplied-functions-tagged-literal-discarded-discard</guid>
<pubDate>Thu, 20 Nov 2025 14:57:19 +0000</pubDate>
</item>
<item>
<title>Typo in clojure.zipper/zipper docstring</title>
<link>https://ask.clojure.org/index.php/14733/typo-in-clojure-zipper-zipper-docstring</link>
<description>&lt;p&gt;The docstring for &lt;code&gt;clojure.zipper/zipper&lt;/code&gt; currently contains:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;branch? is a fn that, given a node, returns true if can have&lt;br&gt;
children, even if it currently doesn't.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;which should be:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;branch? is a fn that, given a node, returns true if it can have&lt;br&gt;
children, even if it currently doesn't.&lt;/p&gt;
&lt;/blockquote&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14733/typo-in-clojure-zipper-zipper-docstring</guid>
<pubDate>Mon, 27 Oct 2025 09:30:17 +0000</pubDate>
</item>
<item>
<title>Replace core.async’s internal LinkedList queue with ArrayDeque?</title>
<link>https://ask.clojure.org/index.php/14696/replace-core-asyncs-internal-linkedlist-queue-arraydeque</link>
<description>&lt;p&gt;Hi! While reading the channel implementation I noticed the internal queue is a &lt;code&gt;java.util.LinkedList&lt;/code&gt;:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/channels.clj&quot;&gt;https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/channels.clj&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The common JVM guidance these days is to prefer &lt;code&gt;java.util.ArrayDeque&lt;/code&gt; for FIFO/LIFO queues due to better locality and lower GC overhead. For example, the JDK docs state: “This class is likely to be faster than Stack when used as a stack, and faster than LinkedList when used as a queue.”&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.oracle.com/javase/8/docs/api/java/util/ArrayDeque.html&quot;&gt;https://docs.oracle.com/javase/8/docs/api/java/util/ArrayDeque.html&lt;/a&gt;&lt;br&gt;
Related SO discussion: &lt;a rel=&quot;nofollow&quot; href=&quot;https://stackoverflow.com/questions/6163166/why-is-arraydeque-better-than-linkedlist&quot;&gt;https://stackoverflow.com/questions/6163166/why-is-arraydeque-better-than-linkedlist&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A few questions for the maintainers:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Was &lt;code&gt;LinkedList&lt;/code&gt; originally chosen for a specific reason (e.g., very old JDK compatibility)?&lt;/li&gt;
&lt;li&gt;Are there behaviors in channels that specifically rely on &lt;code&gt;LinkedList&lt;/code&gt; (e.g., allowing null, I believe channels disallow nil anyway, or particular iterator characteristics), or would &lt;code&gt;ArrayDeque&lt;/code&gt; be a drop-in replacement for the add/remove-from-ends operations used?&lt;/li&gt;
&lt;li&gt;If we provide a small PR and benchmark showing an improvement (lower allocations / better throughput under contention), would such a change be considered?&lt;/li&gt;
&lt;li&gt;Since &lt;code&gt;ArrayDeque&lt;/code&gt; is available on Java 8+, and current Clojure/core.async baselines target that or newer, is there any remaining compatibility concern?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Context: there was an older conversation in Clojurians (#clojure) that suggested ArrayDeque could reduce GC pressure under load and that the original choice may have been influenced by older JDKs:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1KBA2/p1526551888000376&quot;&gt;https://clojurians.slack.com/archives/C03S1KBA2/p1526551888000376&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If this sounds reasonable, I’m happy to run the core.async test suite, add JMH-style benchmarks focused on channel put/take hot paths, and submit a PR.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description>
<category>core.async</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14696/replace-core-asyncs-internal-linkedlist-queue-arraydeque</guid>
<pubDate>Tue, 02 Sep 2025 08:02:18 +0000</pubDate>
</item>
<item>
<title>tools.build compile-clj capture out/err</title>
<link>https://ask.clojure.org/index.php/14648/tools-build-compile-clj-capture-out-err</link>
<description>&lt;p&gt;When calling &lt;code&gt;compile-clj&lt;/code&gt;, a user can pass in &lt;code&gt;:out&lt;/code&gt; and &lt;code&gt;:err&lt;/code&gt; to capture the output of the compilation call. However, if for some reason the sub-process exits with a non-0, &lt;code&gt;compile-clj&lt;/code&gt; throws without returning that output, making it hard to know what went wrong. (see here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.build/blob/2d2f1b05fd84c3cc756221c17fcfb98034b4d65c/src/main/clojure/clojure/tools/build/tasks/compile_clj.clj#L120&quot;&gt;https://github.com/clojure/tools.build/blob/2d2f1b05fd84c3cc756221c17fcfb98034b4d65c/src/main/clojure/clojure/tools/build/tasks/compile_clj.clj#L120&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;I would find it helpful if the ex-data of the thrown exception included the &lt;code&gt;:out&lt;/code&gt; (variable &lt;code&gt;ps-out&lt;/code&gt; and &lt;code&gt;:err&lt;/code&gt; (variable &lt;code&gt;ps-err&lt;/code&gt;) from the &lt;code&gt;process/process&lt;/code&gt; call. Then I could have further insight into what went wrong.&lt;/p&gt;
</description>
<category>tools.build</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14648/tools-build-compile-clj-capture-out-err</guid>
<pubDate>Mon, 28 Jul 2025 19:41:29 +0000</pubDate>
</item>
<item>
<title>Why does a qualified instance method call fails at compile time with NullPointerException if missing target</title>
<link>https://ask.clojure.org/index.php/14596/qualified-instance-compile-nullpointerexception-missing</link>
<description>&lt;p&gt;Has anyone else noticed a lot of Syntax error (NullPointerException) when using the new Class/.instanceMethod syntax? Specifically whenever I forget the first argument like &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(fn [] (String/.length))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;gets&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#error{:cause &quot;Cannot invoke \&quot;clojure.lang.Compiler$Expr.emit(clojure.lang.Compiler$C, clojure.lang.Compiler$ObjExpr, clojure.asm.commons.GeneratorAdapter)\&quot; because \&quot;this.target\&quot; is null&quot;,
       :via [{:type clojure.lang.Compiler$CompilerException,
              :message &quot;Syntax error compiling fn* at (/private/var/folders/cr/wpw7hgnx0jj9m33g28rtbpzc0000gn/T/form-init4871175438924650637.clj:1:1).&quot;,
              :data #:clojure.error{:phase :compile-syntax-check,
                                    :line 1,
                                    :column 1,
                                    :source &quot;/private/var/folders/cr/wpw7hgnx0jj9m33g28rtbpzc0000gn/T/form-init4871175438924650637.clj&quot;,
                                    :symbol fn*},
              :at [clojure.lang.Compiler analyzeSeq &quot;Compiler.java&quot; 7677]}
             {:type java.lang.NullPointerException,
              :message &quot;Cannot invoke \&quot;clojure.lang.Compiler$Expr.emit(clojure.lang.Compiler$C, clojure.lang.Compiler$ObjExpr, clojure.asm.commons.GeneratorAdapter)\&quot; because \&quot;this.target\&quot; is null&quot;,
              :at [clojure.lang.Compiler$InstanceMethodExpr emit &quot;Compiler.java&quot; 2060]}],
       :trace [[clojure.lang.Compiler$InstanceMethodExpr emit &quot;Compiler.java&quot; 2060]
               [clojure.lang.Compiler$BodyExpr emit &quot;Compiler.java&quot; 6723]
               [clojure.lang.Compiler$FnMethod doEmit &quot;Compiler.java&quot; 6243]
               [clojure.lang.Compiler$FnMethod emit &quot;Compiler.java&quot; 6045]
               [clojure.lang.Compiler$FnExpr emitMethods &quot;Compiler.java&quot; 4500]
               [clojure.lang.Compiler$ObjExpr compile &quot;Compiler.java&quot; 5136]
               [clojure.lang.Compiler$FnExpr parse &quot;Compiler.java&quot; 4662]
               [clojure.lang.Compiler analyzeSeq &quot;Compiler.java&quot; 7667]
               [clojure.lang.Compiler analyze &quot;Compiler.java&quot; 7360]
               [clojure.lang.Compiler analyze &quot;Compiler.java&quot; 7316]
               [clojure.lang.Compiler$BodyExpr$Parser parse &quot;Compiler.java&quot; 6683]
               [clojure.lang.Compiler$FnMethod parse &quot;Compiler.java&quot; 6022]
               [clojure.lang.Compiler$FnExpr parse &quot;Compiler.java&quot; 4585]
               [clojure.lang.Compiler analyzeSeq &quot;Compiler.java&quot; 7667]
               [clojure.lang.Compiler analyze &quot;Compiler.java&quot; 7360]
               [clojure.lang.Compiler eval &quot;Compiler.java&quot; 7736]
               [clojure.lang.Compiler eval &quot;Compiler.java&quot; 7694]
               [clojure.core$eval invokeStatic &quot;core.clj&quot; 3232]
               [clojure.core$eval invoke &quot;core.clj&quot; 3228]
               [nrepl.middleware.interruptible_eval$evaluate$fn__966$fn__967 invoke &quot;interruptible_eval.clj&quot; 87]
               [clojure.lang.AFn applyToHelper &quot;AFn.java&quot; 152]
               [clojure.lang.AFn applyTo &quot;AFn.java&quot; 144]
               [clojure.core$apply invokeStatic &quot;core.clj&quot; 667]
               [clojure.core$with_bindings_STAR_ invokeStatic &quot;core.clj&quot; 1990]
               [clojure.core$with_bindings_STAR_ doInvoke &quot;core.clj&quot; 1990]
               [clojure.lang.RestFn invoke &quot;RestFn.java&quot; 428]
               [nrepl.middleware.interruptible_eval$evaluate$fn__966 invoke &quot;interruptible_eval.clj&quot; 87]
               [clojure.main$repl$read_eval_print__9248$fn__9251 invoke &quot;main.clj&quot; 437]
               [clojure.main$repl$read_eval_print__9248 invoke &quot;main.clj&quot; 437]
               [clojure.main$repl$fn__9257 invoke &quot;main.clj&quot; 459]
               [clojure.main$repl invokeStatic &quot;main.clj&quot; 459]
               [clojure.main$repl doInvoke &quot;main.clj&quot; 368]
               [clojure.lang.RestFn invoke &quot;RestFn.java&quot; 1526]
               [nrepl.middleware.interruptible_eval$evaluate invokeStatic &quot;interruptible_eval.clj&quot; 84]
               [nrepl.middleware.interruptible_eval$evaluate invoke &quot;interruptible_eval.clj&quot; 56]
               [nrepl.middleware.interruptible_eval$interruptible_eval$fn__997$fn__1001
                invoke
                &quot;interruptible_eval.clj&quot;
                152]
               [clojure.lang.AFn run &quot;AFn.java&quot; 22]
               [nrepl.middleware.session$session_exec$main_loop__1065$fn__1069 invoke &quot;session.clj&quot; 202]
               [nrepl.middleware.session$session_exec$main_loop__1065 invoke &quot;session.clj&quot; 201]
               [clojure.lang.AFn run &quot;AFn.java&quot; 22]
               [java.lang.Thread run &quot;Thread.java&quot; 1447]]}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14596/qualified-instance-compile-nullpointerexception-missing</guid>
<pubDate>Mon, 30 Jun 2025 13:33:36 +0000</pubDate>
</item>
<item>
<title>File and location data on namespaces</title>
<link>https://ask.clojure.org/index.php/14546/file-and-location-data-on-namespaces</link>
<description>&lt;h3&gt;Preamble&lt;/h3&gt;
&lt;p&gt;Two thoughts:&lt;/p&gt;
&lt;p&gt;Namespaces are not tied to files; they can be created and removed as desired. However, both idiomatically and through &lt;code&gt;clojure.core&lt;/code&gt;, they are &lt;em&gt;typically&lt;/em&gt; tied to files, being specified at the top of a file that shares the same name: &lt;code&gt;src/noahtheduke/splint/rules.clj&lt;/code&gt; holds a single namespace &lt;code&gt;noahtheduke.splint.rules&lt;/code&gt;, which is declared before all other forms. This is enforced in &lt;code&gt;require&lt;/code&gt; and &lt;code&gt;use&lt;/code&gt; calls: &lt;code&gt;(require '[noahtheduke.foo.bar :as fb])&lt;/code&gt; will find a file at &lt;code&gt;src/noahtheduke/bar.clj&lt;/code&gt; and then once the file is loaded will attempt to find the namespace &lt;code&gt;noahtheduke.bar&lt;/code&gt; and raise an error if it does not exist.&lt;/p&gt;
&lt;p&gt;In the compiler, &lt;code&gt;DefExpr&lt;/code&gt; will add to the created var's metadata location data in the form of &lt;code&gt;:line&lt;/code&gt;, &lt;code&gt;:column&lt;/code&gt;, and &lt;code&gt;:file&lt;/code&gt;. The first two come from the seq and latter from &lt;code&gt;*file*&lt;/code&gt;. This allows for introspection and analysis from tooling, and for better error handling in exceptions and messages.&lt;/p&gt;
&lt;h3&gt;Desired functionality&lt;/h3&gt;
&lt;p&gt;I have a collection of namespaces. I want to slurp the corresponding files (if they exist) to analyze and modify with rewrite-clj.&lt;/p&gt;
&lt;h3&gt;Discussion&lt;/h3&gt;
&lt;p&gt;Right now, I use metadata on vars to find relevant objects in code and then find the file that way:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn get-path-from-var [var']
  (let [f (:file (meta var'))
        path (or (some-&amp;gt; f
                         (#(.. (Thread/currentThread)
                               (getContextClassLoader)
                               (getResource %)))
                         (io/file)
                         (str))
                 f)]
    {:path path
     :file (when (and path (.exists (io/file path)))
             (slurp path))}))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, that requires users to use the &lt;code&gt;defcram&lt;/code&gt; macro I've written, which limits the potential for inline-usage of my primary macro &lt;code&gt;compare-output&lt;/code&gt; (such as in a &lt;code&gt;deftest&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;I want to be able to use &lt;code&gt;*ns*&lt;/code&gt; in &lt;code&gt;compare-output&lt;/code&gt; to potentially find where the macro is being called, so I can perform the analysis and desired diffing. This would most easily be done by having location metadata on namespaces.&lt;/p&gt;
&lt;p&gt;But more importantly than just my library, I think having location metadata on namespaces would be a genuine help for many tools (such as eastwood, tools.namespace, CIDER, kibit, splint, etc). &lt;/p&gt;
&lt;h3&gt;Solutions&lt;/h3&gt;
&lt;p&gt;I'm only going to discuss one solution because this is an Ask, not a jira ticket lol.&lt;/p&gt;
&lt;p&gt;I think adding the location metadata in the &lt;code&gt;ns&lt;/code&gt; macro is the best place to put it. The &lt;code&gt;ns&lt;/code&gt; macro is the preferred way to create a new namespace. Creating namespaces with &lt;code&gt;in-ns&lt;/code&gt; or &lt;code&gt;create-ns&lt;/code&gt; requires additional steps to make the namespace usable, and neither is a macro to hold &lt;code&gt;&amp;amp;form&lt;/code&gt; metadata, increasing the work of adding location metadata.&lt;/p&gt;
</description>
<category>Metadata</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14546/file-and-location-data-on-namespaces</guid>
<pubDate>Fri, 16 May 2025 14:46:20 +0000</pubDate>
</item>
<item>
<title>&quot;:added&quot; metadata missing from some new public functions in namespace clojure.java.process</title>
<link>https://ask.clojure.org/index.php/14504/metadata-missing-public-functions-namespace-clojure-process</link>
<description>&lt;p&gt;These functions in the namespace clojure.java.process are mentioned in the doc string for the namespace, and have doc strings, but do not have metadata &lt;code&gt;{:added &quot;1.12&quot;}&lt;/code&gt; as do other new public docstring'ed functions in that namespace:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;stdin&lt;/li&gt;
&lt;li&gt;stdout&lt;/li&gt;
&lt;li&gt;stderr&lt;/li&gt;
&lt;li&gt;exit-ref&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I did not find any other such functions anywhere else that are new in Clojure 1.12.0 vs. Clojure 1.11.1.&lt;/p&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14504/metadata-missing-public-functions-namespace-clojure-process</guid>
<pubDate>Fri, 11 Apr 2025 16:29:23 +0000</pubDate>
</item>
<item>
<title>Idiomatic way to use java.util.Optional</title>
<link>https://ask.clojure.org/index.php/14501/idiomatic-way-to-use-java-util-optional</link>
<description>&lt;p&gt;Is there an easy way to work with &lt;code&gt;java.utils.Optional&lt;/code&gt; values in Clojure? I'm currently using 1.12 so I can say things like &lt;code&gt;(Optional/.orElse foo nil)&lt;/code&gt; to convert the optional value to a &quot;normal&quot; value (X or nil), but that and other Optional methods are still sources of tension or boilerplate compared idiomatic Clojure constructs (&lt;code&gt;some-&amp;gt;&lt;/code&gt; for example).&lt;/p&gt;
&lt;p&gt;If such a way doesn't currently exist, can it be considered for addition to Clojure? Maybe opening up &lt;code&gt;deref&lt;/code&gt; to work on Optionals as well.&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14501/idiomatic-way-to-use-java-util-optional</guid>
<pubDate>Mon, 07 Apr 2025 14:16:59 +0000</pubDate>
</item>
<item>
<title>Docstring typos in clojure.core/bytes, chars, shorts</title>
<link>https://ask.clojure.org/index.php/14447/docstring-typos-in-clojure-core-bytes-chars-shorts</link>
<description>&lt;p&gt;The docstring of &lt;code&gt;clojure.core/bytes&lt;/code&gt; has a minor typo:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;  &quot;Casts to bytes[]&quot;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;which should read &lt;code&gt;byte[]&lt;/code&gt;; similarly for the docstrings of &lt;code&gt;chars&lt;/code&gt; and &lt;code&gt;shorts&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;Given the new array class syntax in Clojure 1.12 perhaps these should be updated to read &lt;code&gt;byte/1&lt;/code&gt;,  &lt;code&gt;float/1&lt;/code&gt; etc. instead of using Java style syntax? &lt;/p&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14447/docstring-typos-in-clojure-core-bytes-chars-shorts</guid>
<pubDate>Thu, 06 Mar 2025 06:54:53 +0000</pubDate>
</item>
<item>
<title>clojure.tools.reader.edn/read can cause incorrect column number for token at end of input</title>
<link>https://ask.clojure.org/index.php/14437/clojure-tools-reader-cause-incorrect-column-number-token-input</link>
<description>&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;&lt;br&gt;
A user reported that &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clj-commons/rewrite-clj/issues/367&quot;&gt;rewrite-clj column number metadata can be incorrect for a token at the end of input&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Rewrite-clj uses clojure.tools/reader to read clojure source.&lt;br&gt;
It uses &lt;code&gt;clojure.tools.reader.reader-types/get-column-number&lt;/code&gt; to discover the current column offset.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Affected&lt;/strong&gt;&lt;br&gt;
clojure.tools/reader v1.3.4 through v1.5.0&lt;br&gt;
Clojure only (not ClojureScript)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Env&lt;/strong&gt;&lt;br&gt;
On Linux using Clojure CLI 1.12.0.1517 with JDK 23.0.2 (temurin)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Symptom&lt;/strong&gt;&lt;br&gt;
When the element at end of input is a token, after it is read, the column number is one less than it should be.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Setup&lt;/strong&gt;&lt;br&gt;
Let's setup a playground in &lt;code&gt;foo.clj&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns foo
  (:require [clojure.pprint :refer [pprint]]
            [clojure.tools.reader.edn :as edn]
            [clojure.tools.reader.reader-types :as rt]))

(defn reader [s]
  (-&amp;gt; s
      rt/string-push-back-reader
      rt/indexing-push-back-reader))

(defn dump-with-cols [s]
  (println &quot;input string:&quot; s)
  (println &quot;colnums:     &quot; (apply str (take (inc (count s)) (cycle [1 2 3 4 5 6 7 8 9 0])))))

(defn read-by-obj [s]
  (with-open [r (reader s)]
    (loop [acc [{:at :bof :col-number (rt/get-column-number r)}]
           obj (edn/read r false ::eof {})]
      (if (not= ::eof obj)
        (recur (conj acc {:after obj :col-number (rt/get-column-number r)})
               (edn/read r false ::eof {}))
        (conj acc {:at :eof :col-number (rt/get-column-number r)})))))

(let [s (first *command-line-args*)]
  (dump-with-cols s)
  (println &quot;parse result:&quot;)
  (pprint (read-by-obj s)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Reproduction&lt;/strong&gt;&lt;br&gt;
Using clojure.tools/reader v1.5.0:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.5.0&quot;}}}' \
        -M foo.clj ':bip :bop'
input string: :bip :bop
colnums:      1234567890
parse result:
[{:at :bof, :col-number 1}
 {:after :bip, :col-number 5}
 {:after :bop, :col-number 9}
 {:at :eof, :col-number 9}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice after &lt;code&gt;:bip&lt;/code&gt; we see the correct &lt;code&gt;:col-number 5&lt;/code&gt;, but after &lt;code&gt;:bop&lt;/code&gt; we see the incorrect &lt;code&gt;:col-number 9&lt;/code&gt;; it should be &lt;code&gt;:col-number 10&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;An incorrect column number occurs for any unwrapped last token, a number:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.5.0&quot;}}}' \
        -M foo.clj 123
input string: 123
colnums:      1234
parse result:
[{:at :bof, :col-number 1}
 {:after 123, :col-number 3}
 {:at :eof, :col-number 3}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;a symbol:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.5.0&quot;}}}' \
        -M foo.clj x
input string: x
colnums:      12
parse result:
[{:at :bof, :col-number 1}
 {:after x, :col-number 1}
 {:at :eof, :col-number 1}]

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But we get a correct result for syntax wrapped elements:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.5.0&quot;}}}' \
        -M foo.clj '(x)'
input string: (x)
colnums:      1234
parse result:
[{:at :bof, :col-number 1}
 {:after (x), :col-number 4}
 {:at :eof, :col-number 4}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Diagnosis&lt;/strong&gt;&lt;br&gt;
If I dial clojure.tools/reader back to v1.3.3, I don't see the issue:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.3.3&quot;}}}' \
        -M foo.clj ':bip :bop'
input string: :bip :bop
colnums:      1234567890
parse result:
[{:at :bof, :col-number 1}
 {:after :bip, :col-number 5}
 {:after :bop, :col-number 10}
 {:at :eof, :col-number 10}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then bump one version to v1.3.4, I see the issue:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.3.4&quot;}}}' \
        -M foo.clj ':bip :bop'
input string: :bip :bop
colnums:      1234567890
parse result:
[{:at :bof, :col-number 1}
 {:after :bip, :col-number 5}
 {:after :bop, :col-number 9}
 {:at :eof, :col-number 9}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There was &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.reader/commit/c8981dd6ac7a560db85321b03278d03caf2aed39&quot;&gt;only one significant change between v1.3.3 and v1.3.4&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Unreading the character at eof is causing the off-by-one issue.&lt;/p&gt;
&lt;p&gt;If I change the &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.reader/blob/30d9f1d04417adc222ab57178dfd56d5d7a01d58/src/main/clojure/clojure/tools/reader/edn.clj#L54-L63&quot;&gt;existing&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  (loop [sb (StringBuilder.)
         ch initch]
    (if (or (whitespace? ch)
            (macro-terminating? ch)
            (nil? ch))
      (do (unread rdr ch)
          (str sb))
      (if (not-constituent? ch)
        (err/throw-bad-char rdr kind ch)
        (recur (doto sb (.append ch)) (read-char rdr))))))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  (loop [sb (StringBuilder.)
         ch initch]
    (cond
      (or (whitespace? ch)
          (macro-terminating? ch))
      (do (unread rdr ch)
          (str sb))

      (nil? ch)
      (str sb)

      (not-constituent? ch)
      (err/throw-bad-char rdr kind ch)

      :else
      (recur (doto sb (.append ch)) (read-char rdr)))))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The problem is resolved for me.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Next Steps&lt;/strong&gt;&lt;br&gt;
Happy to contribute a patch if the above makes sense to you and you think it is worthwhile to fix.&lt;/p&gt;
</description>
<category>tools.reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14437/clojure-tools-reader-cause-incorrect-column-number-token-input</guid>
<pubDate>Sat, 01 Mar 2025 16:58:43 +0000</pubDate>
</item>
<item>
<title>Breaking change in 1.12.0 - a static field is always preferred to a static function with the same name</title>
<link>https://ask.clojure.org/index.php/14435/breaking-change-static-field-always-preferred-static-function</link>
<description>&lt;p&gt;In 1.11.4, if a class has a static field and a static method with the same name, attempting to use the method as a function works as expected.&lt;/p&gt;
&lt;p&gt;In 1.12.0, the static field is always returned instead.&lt;/p&gt;
&lt;p&gt;A CLI reproduction case:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.0
user=&amp;gt; (add-lib 'com.badlogicgames.gdx/gdx)
[com.badlogicgames.gdx/gdx com.badlogicgames.gdx/gdx-jnigen-loader]
user=&amp;gt; (import '(com.badlogic.gdx.math MathUtils))
com.badlogic.gdx.math.MathUtils
user=&amp;gt; MathUtils/random
#object[com.badlogic.gdx.math.RandomXS128 0x3df978b9 &quot;com.badlogic.gdx.math.RandomXS128@3df978b9&quot;]
user=&amp;gt; (MathUtils/random)
#object[com.badlogic.gdx.math.RandomXS128 0x3df978b9 &quot;com.badlogic.gdx.math.RandomXS128@3df978b9&quot;]
user=&amp;gt; (MathUtils/random 0 10)
#object[com.badlogic.gdx.math.RandomXS128 0x3df978b9 &quot;com.badlogic.gdx.math.RandomXS128@3df978b9&quot;]


Clojure 1.11.4
user=&amp;gt; (import '(com.badlogic.gdx.math MathUtils))
com.badlogic.gdx.math.MathUtils
user=&amp;gt; MathUtils/random
#object[com.badlogic.gdx.math.RandomXS128 0x71c905a3 &quot;com.badlogic.gdx.math.RandomXS128@71c905a3&quot;]
user=&amp;gt; (MathUtils/random)
0.37632704
user=&amp;gt; (MathUtils/random 0 10)
0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A potential test case:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;diff --git a/test/clojure/test_clojure/java_interop.clj b/test/clojure/test_clojure/java_interop.clj
index 4a503884..c99370a3 100644
--- a/test/clojure/test_clojure/java_interop.clj
+++ b/test/clojure/test_clojure/java_interop.clj
@@ -20,7 +20,7 @@
             [clojure.test-helper :refer [should-not-reflect]])
   (:import java.util.Base64
            (java.io File FileFilter FilenameFilter)
-           (java.util UUID)
+           (java.util ArrayList Collections$UnmodifiableCollection UUID)
            (java.util.concurrent.atomic AtomicLong AtomicInteger)
            (clojure.test FIConstructor FIStatic FunctionalTester AdapterExerciser)))
 
@@ -783,6 +783,16 @@
   (def fi-static (FIStatic/numbers (fn [i] (&amp;lt; i 0))))
   (is (= [-2 -1] fi-static)))
 
+(deftest static-field-and-method
+  (let [fv FIStatic/numbers
+        mv0 (FIStatic/numbers)
+        mv1 (FIStatic/numbers neg?)]
+    (is (= [-2 -1 0 1 2] fv))
+    (is (instance? Collections$UnmodifiableCollection fv))
+    (is (= [-2 -1 0 1 2] mv0))
+    (is (instance? ArrayList mv0))
+    (is (= [-2 -1] mv1))))
+
 ;; newDirectoryStream is overloaded, takes ^[Path String] or ^[Path DirectoryStream$Filter]
 ;; so this method will reflect
 (defn get-dir-stream [^java.nio.file.Path dir-path glob-pattern]
diff --git a/test/java/clojure/test/FIStatic.java b/test/java/clojure/test/FIStatic.java
index 8273c357..4a8198ae 100644
--- a/test/java/clojure/test/FIStatic.java
+++ b/test/java/clojure/test/FIStatic.java
@@ -1,13 +1,20 @@
 package clojure.test;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.function.Predicate;
 
 public class FIStatic {
 
+    public static List&amp;lt;Integer&amp;gt; numbers = Collections.unmodifiableList(Arrays.asList(-2, -1, 0, 1, 2));
+
+    public static List&amp;lt;Object&amp;gt; numbers () {
+        return new ArrayList&amp;lt;&amp;gt;(numbers);
+    }
+
     public static List&amp;lt;Object&amp;gt; numbers(Predicate&amp;lt;Integer&amp;gt; pred) {
-        List&amp;lt;Integer&amp;gt; numbers = Arrays.asList(-2, -1, 0, 1, 2);
         Object[] filteredNumbers =  numbers.stream().filter(pred).toArray();
         return Arrays.asList(filteredNumbers);
     }
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14435/breaking-change-static-field-always-preferred-static-function</guid>
<pubDate>Fri, 28 Feb 2025 20:06:59 +0000</pubDate>
</item>
<item>
<title>`doseq` and `for` expands body twice</title>
<link>https://ask.clojure.org/index.php/14433/doseq-and-for-expands-body-twice</link>
<description>&lt;p&gt;The bodies of &lt;code&gt;doseq&lt;/code&gt; and &lt;code&gt;for&lt;/code&gt; seem to be duplicated in their expansions.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure
user=&amp;gt; (defmacro a [] (prn :expand))
#'user/a
user=&amp;gt; (doseq [_ nil] (a))
:expand
:expand
nil
user=&amp;gt; (for [_ nil] (a))
:expand
:expand
()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I found the same problem in ClojureScript. I could not find an existing discussion about this so I'm not sure if this is by design, apologies if so. I'm aware that these macros have a large code footprint and that &lt;code&gt;doseq&lt;/code&gt; cannot use closures (the usual way to prevent exponential expansion), but I missed this detail.&lt;/p&gt;
&lt;p&gt;This leads to exponential code blowup if these forms are nested. Artificial demonstration:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure
Clojure 1.12.0
user=&amp;gt; (def counter (atom -1))
#'user/counter
user=&amp;gt; (defmacro a [] (prn :expand (swap! counter inc)))
#'user/a
user=&amp;gt; #(doseq [_ 1] (doseq [_ 2] (doseq [_ 3] (doseq [_ 4] (a)))))
:expand 0
:expand 1
:expand 2
:expand 3
:expand 4
:expand 5
:expand 6
:expand 7
:expand 8
:expand 9
:expand 10
:expand 11
:expand 12
:expand 13
:expand 14
:expand 15
#object[user$eval926$fn__927 0x76563d26 &quot;user$eval926$fn__927@76563d26&quot;]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This might be especially relevant to core.async, where placing &lt;code&gt;go&lt;/code&gt; under &lt;code&gt;doseq&lt;/code&gt; is idiomatic, since &lt;code&gt;go&lt;/code&gt; is expensive in both expansion time and code size.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (time (eval '(doseq [_ nil] (a/go (doseq [_ nil] (a/go (doseq [_ nil] (a/go))))))))
&quot;Elapsed time: 837.230917 msecs&quot;
nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It also leads to duplicated reflection warnings from the fully expanded forms, which is how I found this problem.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (doseq [_ nil] (Thread/sleep (identity 1)))
Reflection warning, NO_SOURCE_PATH:1:16 - call to static method sleep on java.lang.Thread can't be resolved (argument types: unknown).
Reflection warning, NO_SOURCE_PATH:1:16 - call to static method sleep on java.lang.Thread can't be resolved (argument types: unknown).
nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I believe the exponential expansion for &lt;code&gt;doseq&lt;/code&gt; was introduced in Clojure 1.1.0 with support for chunked seqs with &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/commit/1abb7a56de1678321054af7fce183184f06974dd&quot;&gt;this commit&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version &quot;1.0.0&quot;}}}' 
Downloading: org/clojure/clojure/1.0.0/clojure-1.0.0.pom from central
Downloading: org/clojure/clojure/1.0.0/clojure-1.0.0.jar from central
Clojure 1.0.0-
user=&amp;gt; (defmacro a [] (prn :expand))
#'user/a
user=&amp;gt; (doseq [_ nil] (a))
:expand
nil
user=&amp;gt; ^D
$ clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version &quot;1.1.0&quot;}}}'
Downloading: org/clojure/clojure/1.1.0/clojure-1.1.0.pom from central
Downloading: org/clojure/clojure/1.1.0/clojure-1.1.0.jar from central
Clojure 1.1.0
user=&amp;gt; (defmacro a [] (prn :expand))
#'user/a
user=&amp;gt; (doseq [_ nil] (a))
:expand
:expand
nil
user=&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At first I wasn't sure if this was hopeless, but I think &lt;code&gt;doseq&lt;/code&gt; is fixable fusing the chunked and non-chunked cases like so:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defmacro doseq
  &quot;Repeatedly executes body (presumably for side-effects) with
  bindings and filtering as provided by \&quot;for\&quot;.  Does not retain
  the head of the sequence. Returns nil.
  
  Unlike clojure.core/doseq, does not cause exponential macro expansion
  of expressions in bindings or body.&quot;
  [seq-exprs &amp;amp; body]
  (#'clojure.core/assert-args
     (vector? seq-exprs) &quot;a vector for its binding&quot;
     (even? (count seq-exprs)) &quot;an even number of forms in binding vector&quot;)
  (let [step (fn step [recform exprs]
               (if-not exprs
                 [true `(do ~@body)]
                 (let [k (first exprs)
                       v (second exprs)]
                   (if (keyword? k)
                     (let [steppair (step recform (nnext exprs))
                           needrec (steppair 0)
                           subform (steppair 1)]
                       (cond
                         (= k :let) [needrec `(let ~v ~subform)]
                         (= k :while) [false `(when ~v
                                                ~subform
                                                ~@(when needrec [recform]))]
                         (= k :when) [false `(if ~v
                                               (do
                                                 ~subform
                                                 ~@(when needrec [recform]))
                                               ~recform)]))
                     (let [seq- (gensym &quot;seq_&quot;)
                           chunk- (with-meta (gensym &quot;chunk_&quot;)
                                             {:tag 'clojure.lang.IChunk})
                           count- (gensym &quot;count_&quot;)
                           i- (gensym &quot;i_&quot;)
                           in-chunk- (gensym &quot;in-chunk_&quot;)
                           recform `(if ~in-chunk-
                                      (recur ~seq- ~chunk- ~count- (unchecked-inc ~i-))
                                      (recur (next ~seq-) nil 0 0))
                           steppair (step recform (nnext exprs))
                           needrec (steppair 0)
                           subform (steppair 1)]
                       [true
                        `(loop [~seq- (seq ~v), ~chunk- nil,
                                ~count- 0, ~i- 0]
                           (let [~in-chunk- (&amp;lt; ~i- ~count-)
                                 ~seq- (if ~in-chunk- ~seq- (seq ~seq-))]
                             (when (if ~in-chunk- true ~seq-)
                               (let [chunked?# (if ~in-chunk- false (chunked-seq? ~seq-))
                                     ~k (if ~in-chunk-
                                          (.nth ~chunk- ~i-)
                                          (if chunked?# nil (first ~seq-)))]
                                 (if (if ~in-chunk- false chunked?#)
                                   (let [c# (chunk-first ~seq-)]
                                     (recur (chunk-rest ~seq-) c#
                                            (int (count c#)) (int 0)))
                                   (do ~subform
                                       ~@(when needrec [recform])))))))])))))]
    (nth (step nil (seq seq-exprs)) 1)))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14433/doseq-and-for-expands-body-twice</guid>
<pubDate>Wed, 26 Feb 2025 23:15:06 +0000</pubDate>
</item>
<item>
<title>Clojure 1.12 breaks Serialization for records implementing IFn</title>
<link>https://ask.clojure.org/index.php/14410/clojure-breaks-serialization-for-records-implementing-ifn</link>
<description>&lt;p&gt;If you have a class/record that implements a functional interface AND &lt;code&gt;IFn&lt;/code&gt;, serializing it will throw the same error as CLJ-2880. Here's a repro&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [^java.util.function.Function my-f
      (reify
        Serializable
        java.util.function.Function
        clojure.lang.IFn
        )]
  (with-open [os (java.io.ObjectOutputStream. (java.io.ByteArrayOutputStream.))]
    (.writeObject os my-f)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Will throw &lt;code&gt;java.io.NotSerializableException&lt;/code&gt;. If you comment out &lt;code&gt;clojure.lang.IFn&lt;/code&gt;, this code works.&lt;/p&gt;
&lt;p&gt;This is a regression from 1.11.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14410/clojure-breaks-serialization-for-records-implementing-ifn</guid>
<pubDate>Fri, 21 Feb 2025 20:51:39 +0000</pubDate>
</item>
<item>
<title>Please consider making tools.build pom.properties reproducible (e.g. the &quot;Generated by&quot; date)</title>
<link>https://ask.clojure.org/index.php/14389/please-consider-making-properties-reproducible-generated</link>
<description>&lt;p&gt;At the moment (in 1.2.24) the pom.properties includes the current date in a comment, making the resulting jars differ.  For now, in Debian we're deferring to SOURCE_DATE_EPOCH whenever it's set: &lt;a rel=&quot;nofollow&quot; href=&quot;https://salsa.debian.org/clojure-team/tools-build-clojure/-/blob/5739183ec76c39453ff267c6ba19c0605eb406b7/debian/patches/0002-write-pom-make-pom.properties-generated-date-reproducible.patch&quot;&gt;https://salsa.debian.org/clojure-team/tools-build-clojure/-/blob/5739183ec76c39453ff267c6ba19c0605eb406b7/debian/patches/0002-write-pom-make-pom.properties-generated-date-reproducible.patch&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;See also:&lt;br&gt;
- &lt;a rel=&quot;nofollow&quot; href=&quot;https://bugs.debian.org/1095578&quot;&gt;https://bugs.debian.org/1095578&lt;/a&gt; &lt;br&gt;
- &lt;a rel=&quot;nofollow&quot; href=&quot;https://reproducible-builds.org/docs/&quot;&gt;https://reproducible-builds.org/docs/&lt;/a&gt;&lt;br&gt;
- &lt;a rel=&quot;nofollow&quot; href=&quot;https://tests.reproducible-builds.org/debian/pomegranate-clojure&quot;&gt;https://tests.reproducible-builds.org/debian/pomegranate-clojure&lt;/a&gt;&lt;/p&gt;
</description>
<category>tools.build</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14389/please-consider-making-properties-reproducible-generated</guid>
<pubDate>Sun, 16 Feb 2025 18:43:21 +0000</pubDate>
</item>
<item>
<title>clojure.zip/next may execute `make-node` up to 3 times</title>
<link>https://ask.clojure.org/index.php/14387/clojure-zip-next-may-execute-make-node-up-to-3-times</link>
<description>&lt;p&gt;When I traverse a nested structure with a zipper, modify a node deep inside and want to get the whole updated structure back, each time I visit an ancestor node of the modified one, my &lt;code&gt;make-node&lt;/code&gt; function is unnecessarily called &lt;strong&gt;3 times&lt;/strong&gt; by the &lt;code&gt;clojure.zip/next&lt;/code&gt; function.&lt;/p&gt;
&lt;p&gt;Reviewing the implementation of the &lt;code&gt;next&lt;/code&gt; function, I see that storing the result of &lt;code&gt;(up p)&lt;/code&gt; in a variable/binding would get me rid of the extra &lt;code&gt;make-node&lt;/code&gt; calls (and I have tested that it does).&lt;/p&gt;
&lt;p&gt;I identified this issue in a Clojurescript REPL but it looks like it's present in the Clojure implementation, too.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14387/clojure-zip-next-may-execute-make-node-up-to-3-times</guid>
<pubDate>Fri, 14 Feb 2025 10:55:35 +0000</pubDate>
</item>
<item>
<title>Auto-descending in clojure.data.zip doesn't seem to make a difference</title>
<link>https://ask.clojure.org/index.php/14380/auto-descending-clojure-data-zip-doesnt-seem-make-difference</link>
<description>&lt;p&gt;Learning about zippers, I am trying to make sense of the difference between &lt;code&gt;children&lt;/code&gt; and &lt;code&gt;children-auto&lt;/code&gt;, as documented in the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.github.io/data.zip/&quot;&gt;auto-generated docs&lt;/a&gt;, however, by reviewing the code and inspecting its history with git-log, it looks like the last reading of this meta property (possibly through the &lt;code&gt;auto?&lt;/code&gt; function) was removed by &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/data.zip/commit/c5d6ca25c128f9fe937b11505c7c9736cfa2dd9a&quot;&gt;this commit in 2016&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I think I will give up my trying to understand what &quot;auto-descending by &lt;code&gt;tag=&lt;/code&gt;&quot; meant when it no longer matters. I would find it good to remove mentions of it from the documentation to save time to future learners like me, or at least clarify that the behaviour of &lt;code&gt;tag=&lt;/code&gt; doesn't change with the choice of &lt;code&gt;children&lt;/code&gt; v. &lt;code&gt;children-auto&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;What &lt;em&gt;could&lt;/em&gt; change, anyway, if there is no code sensitive to this metadatum in the library? Is there another library that uses it, or is it targeted only at user code (remembered in a comment to the &lt;code&gt;auto&lt;/code&gt; function), or is it just not useful anymore and should the metadatum (the &lt;code&gt;:zip-filter/no-auto?&lt;/code&gt; key) be dropped and associated functions (including &lt;code&gt;children-auto&lt;/code&gt;) with it?&lt;/p&gt;
</description>
<category>data.zip</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14380/auto-descending-clojure-data-zip-doesnt-seem-make-difference</guid>
<pubDate>Mon, 10 Feb 2025 11:05:44 +0000</pubDate>
</item>
<item>
<title>When using remote prepl server, *repl* is false, preventing use of add-lib and related functions</title>
<link>https://ask.clojure.org/index.php/14374/using-remote-prepl-server-false-preventing-related-functions</link>
<description>&lt;p&gt;To reproduce:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clojure -J-Dclojure.server.jvm=&quot;{:port 5555 :accept clojure.core.server/io-prepl}&quot;

Clojure 1.12.0
user=&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;then&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nc localhost 5555
*repl*
{:tag :ret, :val &quot;false&quot;, :ns &quot;user&quot;, :ms 0, :form &quot;*repl*&quot;}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>REPL</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14374/using-remote-prepl-server-false-preventing-related-functions</guid>
<pubDate>Thu, 06 Feb 2025 13:54:48 +0000</pubDate>
</item>
<item>
<title>clojure.data.xml.event: EndElementEvent should provide tag and location-info</title>
<link>https://ask.clojure.org/index.php/14184/clojure-data-event-endelementevent-should-provide-location</link>
<description>&lt;p&gt;Additional information on the EndElementEvent would be very helpful, especially for processing large data in a streaming way.&lt;/p&gt;
&lt;p&gt;I would be happy to propose a patch – I've already signed the Contributor Agreement&lt;/p&gt;
</description>
<category>data.xml</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14184/clojure-data-event-endelementevent-should-provide-location</guid>
<pubDate>Thu, 10 Oct 2024 14:34:39 +0000</pubDate>
</item>
<item>
<title>seque forces n+2 items ahead of consumer instead of n</title>
<link>https://ask.clojure.org/index.php/14178/seque-forces-n-2-items-ahead-of-consumer-instead-of-n</link>
<description>&lt;p&gt;seque's documentation says:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The queued seq will produce a concrete seq in the background, and can&lt;br&gt;
get up to n items ahead of the consumer.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It seems to force n+2 items ahead of the consumer.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [producer (fn step [i]
                 (lazy-seq
                   (prn &quot;producer&quot; i)
                   (cons i (step (inc i)))))
      s (seque 1 (producer 0))]
  (Thread/sleep 1000)
  nil)
;=&quot;producer&quot; 0
;=&quot;producer&quot; 1
;=&quot;producer&quot; 2
nil
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Sequences</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14178/seque-forces-n-2-items-ahead-of-consumer-instead-of-n</guid>
<pubDate>Tue, 08 Oct 2024 21:33:17 +0000</pubDate>
</item>
<item>
<title>No path in loop recur arg warning</title>
<link>https://ask.clojure.org/index.php/14126/no-path-in-loop-recur-arg-warning</link>
<description>&lt;p&gt;Reflection warnings, such as for reflective method calls, are printed with the full source path (&lt;code&gt;Compiler/SOURCE_PATH&lt;/code&gt;). This is different in case of the warning about &lt;code&gt;loop&lt;/code&gt; recur args,  printed with the source filename only (&lt;code&gt;Compiler/SOURCE&lt;/code&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(set! *warn-on-reflection* true)

(defn reflective-method-call [] (.substring (try &quot;&quot;) 0))

(defn boxed-recur-arg [] (loop [i 0] (recur (try i))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;...which prints:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Reflection warning, /home/pawel/dev/project/src/core.clj:22:33 - call to method substring can't be resolved (target class is unknown).
core.clj:24 recur arg for primitive local: i is not matching primitive, had: Object, needed: long
Auto-boxing loop arg: i
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;IMHO, the path is useful, especially if the filename is generic and inside a dependency.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14126/no-path-in-loop-recur-arg-warning</guid>
<pubDate>Sat, 21 Sep 2024 13:12:31 +0000</pubDate>
</item>
<item>
<title>clj -X:deps find-versions prefers git deps if both git and mvn exist</title>
<link>https://ask.clojure.org/index.php/14106/clj-deps-find-versions-prefers-git-deps-both-git-and-mvn-exist</link>
<description>&lt;h2&gt;Environment&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;clj --version
Clojure CLI version 1.12.0.1479
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Source&lt;/h2&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C6QH853H8/p1726065319663009?thread_ts=1726063714.496649&amp;amp;cid=C6QH853H8&quot;&gt;A chat on Slack&lt;/a&gt; where we happened to notice the behaviour.&lt;/p&gt;
&lt;h2&gt;Scenario&lt;/h2&gt;
&lt;p&gt;When lib x is both a git dep and a maven dep,&lt;br&gt;
 &lt;code&gt;clj -X:deps find-versions :lib x&lt;/code&gt; shows only versions from git deps.&lt;/p&gt;
&lt;p&gt;Specific example: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.build&quot;&gt;io.github.clojure/tools.build&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As a git dep:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;io.github.clojure/tools.build {:git/tag &quot;v0.10.5&quot; :git/sha &quot;2a21b7a&quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As a Maven dep:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;io.github.clojure/tools.build {:mvn/version &quot;0.10.5&quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Reproduction&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;clj -X:deps find-versions :lib io.github.clojure/tools.build
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Actual Behavior&lt;/h2&gt;
&lt;p&gt;Versions from git deps are listed:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:git/tag &quot;v0.9.4&quot;, :git/sha &quot;76b78fe&quot;}
{:git/tag &quot;v0.9.5&quot;, :git/sha &quot;24f2894&quot;}
{:git/tag &quot;v0.9.6&quot;, :git/sha &quot;8e78bcc&quot;}
{:git/tag &quot;v0.10.0&quot;, :git/sha &quot;3a2c484&quot;}
{:git/tag &quot;v0.10.1&quot;, :git/sha &quot;5e3b8f3&quot;}
{:git/tag &quot;v0.10.3&quot;, :git/sha &quot;15ead66&quot;}
{:git/tag &quot;v0.10.4&quot;, :git/sha &quot;31388ff&quot;}
{:git/tag &quot;v0.10.5&quot;, :git/sha &quot;2a21b7a&quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Expected Behavior&lt;/h2&gt;
&lt;p&gt;TBD by Alex, but note that although &lt;a rel=&quot;nofollow&quot; href=&quot;https://central.sonatype.com/artifact/io.github.clojure/tools.build/versions&quot;&gt;maven deps exist&lt;/a&gt;, they are not listed. &lt;/p&gt;
&lt;p&gt;A few ideas to poke at:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Idea One:  populate this list with all available versions:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:mvn/version &quot;0.9.4&quot; :git/tag &quot;v0.9.4&quot;, :git/sha &quot;76b78fe&quot;}
{:mvn/version &quot;0.9.5&quot; :git/tag &quot;v0.9.5&quot;, :git/sha &quot;24f2894&quot;}
{:mvn/version &quot;0.9.6&quot; :git/tag &quot;v0.9.6&quot;, :git/sha &quot;8e78bcc&quot;}
{:mvn/version &quot;0.10.0&quot; :git/tag &quot;v0.10.0&quot;, :git/sha &quot;3a2c484&quot;}
{:mvn/version &quot;0.10.1&quot; :git/tag &quot;v0.10.1&quot;, :git/sha &quot;5e3b8f3&quot;}
{:mvn/version &quot;0.10.3&quot; git/tag &quot;v0.10.3&quot;, :git/sha &quot;15ead66&quot;}
{:mvn/version &quot;0.10.4&quot; :git/tag &quot;v0.10.4&quot;, :git/sha &quot;31388ff&quot;}
{:mvn/version &quot;0.10.5&quot; :git/tag &quot;v0.10.5&quot;, :git/sha &quot;2a21b7a&quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But maybe that's a bit confusing for users copy/paste-wise.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Idea Two: list all available versions side by side:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:mvn/version &quot;0.9.4&quot;} {:git/tag &quot;v0.9.4&quot;, :git/sha &quot;76b78fe&quot;}
{:mvn/version &quot;0.9.5&quot;} {:git/tag &quot;v0.9.5&quot;, :git/sha &quot;24f2894&quot;}
{:mvn/version &quot;0.9.6&quot;} {git/tag &quot;v0.9.6&quot;, :git/sha &quot;8e78bcc&quot;}
{:mvn/version &quot;0.10.0&quot;} {:git/tag &quot;v0.10.0&quot;, :git/sha &quot;3a2c484&quot;}
{:mvn/version &quot;0.10.1&quot;} {:git/tag &quot;v0.10.1&quot;, :git/sha &quot;5e3b8f3&quot;}
{:mvn/version &quot;0.10.3&quot;} {git/tag &quot;v0.10.3&quot;, :git/sha &quot;15ead66&quot;}
{:mvn/version &quot;0.10.4&quot;} {:git/tag &quot;v0.10.4&quot;, :git/sha &quot;31388ff&quot;}
{:mvn/version &quot;0.10.5&quot;} {:git/tag &quot;v0.10.5&quot;, :git/sha &quot;2a21b7a&quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Idea Three: list all available versions sequentially&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:mvn/version &quot;0.9.4&quot;} 
{:mvn/version &quot;0.9.5&quot;} 
{:mvn/version &quot;0.9.6&quot;} 
{:mvn/version &quot;0.10.0&quot;}
{:mvn/version &quot;0.10.1&quot;}
{:mvn/version &quot;0.10.3&quot;}
{:mvn/version &quot;0.10.4&quot;} 
{:mvn/version &quot;0.10.5&quot;} 
{:mvn/version &quot;0.9.4&quot; :git/tag &quot;v0.9.4&quot;, :git/sha &quot;76b78fe&quot;}
{:mvn/version &quot;0.9.5&quot; :git/tag &quot;v0.9.5&quot;, :git/sha &quot;24f2894&quot;}
{:mvn/version &quot;0.9.6&quot; :git/tag &quot;v0.9.6&quot;, :git/sha &quot;8e78bcc&quot;}
{:mvn/version &quot;0.10.0&quot; :git/tag &quot;v0.10.0&quot;, :git/sha &quot;3a2c484&quot;}
{:mvn/version &quot;0.10.1&quot; :git/tag &quot;v0.10.1&quot;, :git/sha &quot;5e3b8f3&quot;}
{:mvn/version &quot;0.10.3&quot; git/tag &quot;v0.10.3&quot;, :git/sha &quot;15ead66&quot;}
{:mvn/version &quot;0.10.4&quot; :git/tag &quot;v0.10.4&quot;, :git/sha &quot;31388ff&quot;}
{:mvn/version &quot;0.10.5&quot; :git/tag &quot;v0.10.5&quot;, :git/sha &quot;2a21b7a&quot;}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>tools.deps</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14106/clj-deps-find-versions-prefers-git-deps-both-git-and-mvn-exist</guid>
<pubDate>Wed, 11 Sep 2024 20:16:33 +0000</pubDate>
</item>
<item>
<title>Separate bindable reporting function from clojure.test/report</title>
<link>https://ask.clojure.org/index.php/14089/separate-bindable-reporting-function-from-clojure-report</link>
<description>&lt;p&gt;&lt;strong&gt;Set Up&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;clojure.test&lt;/code&gt; is built on the idea that a test will call an assertion function that directly calls a reporting function: &lt;code&gt;is&lt;/code&gt; calls &lt;code&gt;report&lt;/code&gt; (through &lt;code&gt;do-report&lt;/code&gt;). The function &lt;code&gt;report&lt;/code&gt; is a multimethod, allowing for adding or overriding keys to allow for implementing alternative reporting styles. It's also dynamic, meant to be rebound if an entirely new reporting system is to be used (TAP, JUnit, etc).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As discussed in the excellent &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/lambdaisland/kaocha/blob/15e553ddba5497a91099f0edda8433d66ef1094f/src/kaocha/report.clj#L40-L71&quot;&gt;kaocha source code&lt;/a&gt;, these two approaches don't work together, which leads to issues such as kaocha's workarounds (and monkey-patching), &lt;a rel=&quot;nofollow&quot; href=&quot;https://codeberg.org/leiningen/leiningen/src/commit/795c3a5d68de7a2465582da4184c42d7bd065c76/sample.project.clj#L371-L373&quot;&gt;leiningen&lt;/a&gt;'s monkey-patching, Cursive's test runner not always integrating with other tools due to &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C0744GXCJ/p1720462210536379?thread_ts=1713354339.092179&amp;amp;cid=C0744GXCJ&quot;&gt;binding &lt;code&gt;report&lt;/code&gt;&lt;/a&gt;, and others.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.lambdasierra.com/2022/hello&quot;&gt;Alessandra Sierra&lt;/a&gt; wrote about &lt;a rel=&quot;nofollow&quot; href=&quot;https://stuartsierra.com/2010/07/05/lazytest-status-report&quot;&gt;this issue&lt;/a&gt; as well when she attempted a follow-up to &lt;code&gt;clojure.test&lt;/code&gt; called Lazytest (which I have resurrected over the last year). She ended up not finishing the library, and many other alternatives to Clojure test have not been as successful as one might hope either.&lt;/p&gt;
&lt;p&gt;Given that &lt;code&gt;clojure.test&lt;/code&gt; is here to stay, it seems prudent to make it easier to use and adapt without changing the fundamental api.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Potential Solution&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Separating the &quot;dynamic variable to be rebound&quot; from &quot;the default reporting function&quot; would make it easier for libraries and tools to choose to extend &lt;code&gt;report&lt;/code&gt; or replace it entirely, without worrying that they'll clash or run into each other. This can be accomplished by adding a new dynamic variable &lt;code&gt;*reporter*&lt;/code&gt; to &lt;code&gt;clojure.test&lt;/code&gt; that &lt;code&gt;do-report&lt;/code&gt; calls, and defaulting &lt;code&gt;*reporter*&lt;/code&gt; to &lt;code&gt;clojure.test/report&lt;/code&gt;. (&lt;code&gt;report&lt;/code&gt; would stay dynamic so as to not change working code.)&lt;/p&gt;
&lt;p&gt;With such a change in place, workarounds such as Leiningen's &lt;a rel=&quot;nofollow&quot; href=&quot;https://codeberg.org/leiningen/leiningen/src/commit/b72ac7840c34e89eb358bada5ab5c2466008d476/src/leiningen/test.clj#L115-L129&quot;&gt;monkey-patching&lt;/a&gt; could simply bind &lt;code&gt;*report*&lt;/code&gt; with a new function and not worry about stepping on any other library's toes.&lt;/p&gt;
</description>
<category>Test</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14089/separate-bindable-reporting-function-from-clojure-report</guid>
<pubDate>Tue, 27 Aug 2024 18:38:20 +0000</pubDate>
</item>
<item>
<title>The new array class syntax in 1.12 doesn't seem to be supported by definterface meta tags</title>
<link>https://ask.clojure.org/index.php/14083/array-class-syntax-doesnt-seem-supported-definterface-meta</link>
<description>&lt;p&gt;Noticed by user yuhan in slack &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1KBA2/p1724499452475139&quot;&gt;https://clojurians.slack.com/archives/C03S1KBA2/p1724499452475139&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;❯ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version &quot;1.12.0-rc1&quot;}}}'
Clojure 1.12.0-rc1
user=&amp;gt; (definterface Foo (^String/1 bar []))
user.Foo
user=&amp;gt; (reify Foo (bar [this]))
Syntax error (ClassNotFoundException) compiling reify* at (REPL:1:1).
java.lang.String.1
user=&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14083/array-class-syntax-doesnt-seem-supported-definterface-meta</guid>
<pubDate>Sat, 24 Aug 2024 12:30:36 +0000</pubDate>
</item>
<item>
<title>New add-lib in Clojure 1.12 doesn't load data readers brought by the lib</title>
<link>https://ask.clojure.org/index.php/14068/new-add-lib-clojure-doesnt-load-data-readers-brought-the-lib</link>
<description>&lt;p&gt;I see that the new &lt;code&gt;add-lib&lt;/code&gt; in Clojure 1.12 doesn't call &lt;code&gt;clojure.core/load-data-readers&lt;/code&gt; (like clojure.core does on loading) so if you bring libraries that have data-readers you can't use them.&lt;/p&gt;
&lt;p&gt;Calling &lt;code&gt;clojure.core/load-data-readers&lt;/code&gt; from the repl doesn't solve the issue since it changes &lt;code&gt;*data-readers*&lt;/code&gt; root value which is already being shadowed by clojure.main/repl.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version &quot;1.12.0-rc1&quot;} com.github.flow-storm/flow-storm-dbg {:mvn/version &quot;3.17.2&quot;}}}'
Clojure 1.12.0-rc1
user=&amp;gt; *data-readers*
{trace #'flow-storm.api/read-trace-tag, ctrace #'flow-storm.api/read-ctrace-tag, rtrace #'flow-storm.api/read-rtrace-tag, tap #'flow-storm.api/read-tap-tag, tap-stack-trace #'flow-storm.api/read-tap-stack-trace-tag, flow-storm.types/value-ref #'flow-storm.types/make-value-ref, amalloy/ring-buffer #'amalloy.ring-buffer/read-method}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;now with add-lib :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version &quot;1.12.0-rc1&quot;}}}'                                                             
Clojure 1.12.0-rc1
user=&amp;gt; (add-lib 'com.github.flow-storm/flow-storm-dbg {:mvn/version &quot;3.17.2&quot;})
[...]
user=&amp;gt; *data-readers*
{}
user=&amp;gt; (#'clojure.core/load-data-readers)
{trace #'flow-storm.api/read-trace-tag, ctrace #'flow-storm.api/read-ctrace-tag, rtrace #'flow-storm.api/read-rtrace-tag, tap #'flow-storm.api/read-tap-tag, tap-stack-trace #'flow-storm.api/read-tap-stack-trace-tag, flow-storm.types/value-ref #'flow-storm.types/make-value-ref, amalloy/ring-buffer #'amalloy.ring-buffer/read-method}
user=&amp;gt; *data-readers*
{}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The only way I see to bring in data-readers with add-lib is by starting a sub-repl :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version &quot;1.12.0-rc1&quot;}}}'
Clojure 1.12.0-rc1
user=&amp;gt; (add-lib 'com.github.flow-storm/flow-storm-dbg {:mvn/version &quot;3.17.2&quot;})
[...]
user=&amp;gt; (binding [*data-readers* (#'clojure.core/load-data-readers)] (clojure.main/repl))
user=&amp;gt; *data-readers*
{trace #'flow-storm.api/read-trace-tag, ctrace #'flow-storm.api/read-ctrace-tag, rtrace #'flow-storm.api/read-rtrace-tag, tap #'flow-storm.api/read-tap-tag, tap-stack-trace #'flow-storm.api/read-tap-stack-trace-tag, flow-storm.types/value-ref #'flow-storm.types/make-value-ref, amalloy/ring-buffer #'amalloy.ring-buffer/read-method}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which won't work with nrepl tooling.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14068/new-add-lib-clojure-doesnt-load-data-readers-brought-the-lib</guid>
<pubDate>Tue, 20 Aug 2024 20:42:06 +0000</pubDate>
</item>
<item>
<title>defn rejects arity with args vector [&amp;form]</title>
<link>https://ask.clojure.org/index.php/14057/defn-rejects-arity-with-args-vector-form</link>
<description>&lt;p&gt;Here's the smallest case, but it seems to happen no matter how many other arities are provided or whether list or vector syntax is used for the arity.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (clojure-version)
&quot;1.12.0-rc1&quot;
user=&amp;gt; (defn f [&amp;amp;form])
Unexpected error (IndexOutOfBoundsException) macroexpanding defn at (REPL:1:1).
null
user=&amp;gt; *e
#error {
 :cause nil
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message &quot;Unexpected error macroexpanding defn at (1:1).&quot;
   :data #:clojure.error{:phase :macroexpansion, :line 1, :column 1, :source &quot;NO_SOURCE_PATH&quot;, :symbol defn}
   :at [clojure.lang.Compiler macroexpand1 &quot;Compiler.java&quot; 7551]}
  {:type java.lang.IndexOutOfBoundsException
   :message nil
   :at [clojure.lang.RT subvec &quot;RT.java&quot; 1634]}]
 :trace
 [[clojure.lang.RT subvec &quot;RT.java&quot; 1634]
  [clojure.core$sigs$asig__5505 invoke &quot;core.clj&quot; 235]
  [clojure.core$sigs invokeStatic &quot;core.clj&quot; 259]
  [clojure.core$defn__5514 invokeStatic &quot;core.clj&quot; 317]
  [clojure.core$defn__5514 doInvoke &quot;core.clj&quot; 294]
  [clojure.lang.RestFn applyTo &quot;RestFn.java&quot; 149]
  [clojure.lang.Var applyTo &quot;Var.java&quot; 707]
  [clojure.lang.Compiler macroexpand1 &quot;Compiler.java&quot; 7525]
  [clojure.lang.Compiler macroexpand &quot;Compiler.java&quot; 7598]
  [clojure.lang.Compiler eval &quot;Compiler.java&quot; 7684]
  [clojure.lang.Compiler eval &quot;Compiler.java&quot; 7655]
  [clojure.core$eval invokeStatic &quot;core.clj&quot; 3232]
  [clojure.core$eval invoke &quot;core.clj&quot; 3228]
  [clojure.main$repl$read_eval_print__9240$fn__9243 invoke &quot;main.clj&quot; 437]
  [clojure.main$repl$read_eval_print__9240 invoke &quot;main.clj&quot; 437]
  [clojure.main$repl$fn__9249 invoke &quot;main.clj&quot; 459]
  [clojure.main$repl invokeStatic &quot;main.clj&quot; 459]
  [clojure.main$repl_opt invokeStatic &quot;main.clj&quot; 523]
  [clojure.main$main invokeStatic &quot;main.clj&quot; 668]
  [clojure.main$main doInvoke &quot;main.clj&quot; 617]
  [clojure.lang.RestFn invoke &quot;RestFn.java&quot; 400]
  [clojure.lang.AFn applyToHelper &quot;AFn.java&quot; 152]
  [clojure.lang.RestFn applyTo &quot;RestFn.java&quot; 135]
  [clojure.lang.Var applyTo &quot;Var.java&quot; 707]
  [clojure.main main &quot;main.java&quot; 40]]}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14057/defn-rejects-arity-with-args-vector-form</guid>
<pubDate>Mon, 19 Aug 2024 21:05:00 +0000</pubDate>
</item>
<item>
<title>clojure.pprint/pprint converts unquote+deref to unquote-splicing</title>
<link>https://ask.clojure.org/index.php/14053/clojure-pprint-pprint-converts-unquote-deref-unquote-splicing</link>
<description>&lt;p&gt;This is very unusual syntax but pretty-printing it does not round-trip.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clj -Sforce -Sdeps '{:deps {org.clojure/clojure {:mvn/version &quot;1.11.4&quot;}}}'
Clojure 1.11.4
user=&amp;gt; (require '[clojure.pprint :as pp])
nil
user=&amp;gt; (-&amp;gt; &quot;~ @a&quot; read-string pp/pprint)
~@a
nil
user=&amp;gt; (-&amp;gt; '~ @a)
(clojure.core/unquote (clojure.core/deref a))
user=&amp;gt; (-&amp;gt; '~ @a pp/pprint with-out-str read-string)
(clojure.core/unquote-splicing a)
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Printing</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14053/clojure-pprint-pprint-converts-unquote-deref-unquote-splicing</guid>
<pubDate>Mon, 12 Aug 2024 23:25:23 +0000</pubDate>
</item>
<item>
<title>Why does clojure.core/newline not respect *flush-on-newline*?</title>
<link>https://ask.clojure.org/index.php/14044/why-does-clojure-core-newline-not-respect-flush-on-newline</link>
<description>&lt;p&gt;Calling &lt;code&gt;(newline)&lt;/code&gt; appends a newline to the output stream but does not flush it &lt;code&gt;*flush-on-newline*&lt;/code&gt; is bound to &lt;code&gt;true&lt;/code&gt; (the default).&lt;/p&gt;
&lt;p&gt;Instead, only &lt;code&gt;clojure.core/prn&lt;/code&gt; mentions &lt;code&gt;*flush-on-newline*&lt;/code&gt; in its docstring and the check and &lt;code&gt;(flush)&lt;/code&gt; call is explicit there.&lt;/p&gt;
&lt;p&gt;Why is this?&lt;/p&gt;
&lt;p&gt;Also, &lt;code&gt;println&lt;/code&gt; does not mention that it &lt;code&gt;Observes *flush-on-newline*&lt;/code&gt; like &lt;code&gt;prn&lt;/code&gt; does, and it doesn't hint that it calls &lt;code&gt;prn&lt;/code&gt; which does, since it says &lt;code&gt;Same as print followed by (newline)&lt;/code&gt; which isn't actually true.&lt;/p&gt;
</description>
<category>Printing</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14044/why-does-clojure-core-newline-not-respect-flush-on-newline</guid>
<pubDate>Wed, 07 Aug 2024 23:09:06 +0000</pubDate>
</item>
<item>
<title>Comparison ops &quot;Return non-nil if..., otherwise false&quot;</title>
<link>https://ask.clojure.org/index.php/14034/comparison-ops-return-non-nil-if-otherwise-false</link>
<description>&lt;p&gt;The docstring of &amp;lt; (and others) says:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Returns non-nil if nums are in monotonically decreasing order,
otherwise false.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That seems a bit weird since a) they return either &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt; and b) &lt;code&gt;false&lt;/code&gt; is &quot;non-&lt;code&gt;nil&lt;/code&gt;&quot; so it seems misleading / unhelpful.&lt;/p&gt;
&lt;p&gt;What is the history for saying &quot;non-&lt;code&gt;nil&lt;/code&gt;&quot; rather than &lt;code&gt;true&lt;/code&gt;?&lt;/p&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14034/comparison-ops-return-non-nil-if-otherwise-false</guid>
<pubDate>Wed, 31 Jul 2024 01:41:56 +0000</pubDate>
</item>
<item>
<title>Missing documentation for `:while` modifier of `for` and `doseq`</title>
<link>https://ask.clojure.org/index.php/14002/missing-documentation-for-while-modifier-of-for-and-doseq</link>
<description>&lt;p&gt;I believe the &lt;code&gt;for&lt;/code&gt; and &lt;code&gt;doseq&lt;/code&gt; documentation (at least docstrings) fail to explain the semantics of the &lt;code&gt;:while&lt;/code&gt; modifier. The existence is documented, but not the behavior.&lt;/p&gt;
&lt;p&gt;I would like to request that the doctoring be updated, especially since it behaves in what I believe is a reasonable but counter-intuitive way. I believe a reasonable person would expect that &lt;code&gt;:while false&lt;/code&gt; would trigger the &lt;code&gt;for&lt;/code&gt; or &lt;code&gt;doseq&lt;/code&gt; to exit; however it does not. Rather it causes the inner-most loop containing the &lt;code&gt;:while&lt;/code&gt; to exit, but most notably the outer loops continue to iterate.&lt;/p&gt;
&lt;p&gt;Another discussion of this can be found here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C053AK3F9/p1719593304442819&quot;&gt;clojurians&lt;/a&gt;&lt;/p&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14002/missing-documentation-for-while-modifier-of-for-and-doseq</guid>
<pubDate>Mon, 01 Jul 2024 13:56:08 +0000</pubDate>
</item>
<item>
<title>Using integer parameters in deftype annotations</title>
<link>https://ask.clojure.org/index.php/13998/using-integer-parameters-in-deftype-annotations</link>
<description>&lt;p&gt;I am trying to use a Java library that uses annotations on Java classes and methods, so I pass to it deftypes with annotated methods. Some of the annotations require using integer parameters and it seems there is no  convenient way to do this in Clojure. The code I am trying is something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(deftype SomeType []
  (^{Retention RetentionPolicy/RUNTIME
     SomeAnnotationClass {:order 1} }
   someMethod [_]...)) 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;:order 1&lt;/code&gt; part causes an exception:&lt;/p&gt;
&lt;p&gt; &lt;code&gt;Incorrectly typed data found for annotation element ... (Found data of type java.lang.Long[1])&lt;/code&gt; &lt;/p&gt;
&lt;p&gt;This happens because the java library expects that &lt;code&gt;:order&lt;/code&gt; would have a java.lang.Integer value, but Clojure creates a java.lang.Long. If I try (int 1)  instead of 1, I get another exception.&lt;/p&gt;
&lt;p&gt;I asked for help on clojurians Slack, and it was suggested that I use &lt;code&gt;#java.lang.Integer[1]&lt;/code&gt; instead of simply 1. This works, but it would be nice to have a more intuitive way to do this.&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13998/using-integer-parameters-in-deftype-annotations</guid>
<pubDate>Sun, 30 Jun 2024 18:44:17 +0000</pubDate>
</item>
<item>
<title>Locals clearing + forcing a delay recursively results in NPE</title>
<link>https://ask.clojure.org/index.php/13930/locals-clearing-forcing-a-delay-recursively-results-in-npe</link>
<description>&lt;p&gt;Discovered by Ambrose Bonnaire-Sergeant (@ambrosebs).&lt;/p&gt;
&lt;p&gt;Given this convoluted example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [f +
      p (promise)
      d (delay (f) @@p)]
 (deliver p d)
 @d)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When executed, it fails with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;1. Unhandled java.lang.NullPointerException
   Cannot invoke &quot;clojure.lang.IFn.invoke()&quot; because &quot;this.f&quot; is null
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same error happens with lazy seqs:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [f +
      p (promise)
      d (lazy-seq (f) (first @p))]
  (deliver p d)
  (first d))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The reason in both cases is that locals clearing assigns &lt;code&gt;this.f = null;&lt;/code&gt; right after it is first invoked, so when the recursive call reaches &lt;code&gt;(f)&lt;/code&gt; again, the reference is already nil.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(binding [*compiler-options* {:disable-locals-clearing false}]
  (clj-java-decompiler.core/decompile
   (defn repro []
     (let [f +
        p (promise)
        d (delay (f) @@p)]
    (deliver p d)
    @d))))

=&amp;gt;

@Override
public Object invoke() {
    final Object f = this.f;
    this.f = null;
    ((IFn)f).invoke();
    final IFn fn = (IFn)__deref.getRawRoot();
    final IFn fn2 = (IFn)__deref.getRawRoot();
    final Object p = this.p;
    this.p = null;
    final Object invoke = fn2.invoke(p);
    this = null;
    return fn.invoke(invoke);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is this a bug or undefined behavior?&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13930/locals-clearing-forcing-a-delay-recursively-results-in-npe</guid>
<pubDate>Thu, 30 May 2024 21:11:28 +0000</pubDate>
</item>
<item>
<title>Expand FI adapting to SAM types (not marked as FI)</title>
<link>https://ask.clojure.org/index.php/13908/expand-fi-adapting-to-sam-types-not-marked-as-fi</link>
<description>&lt;p&gt;There are a lot of SAM types that are not FI in the JDK - some prominent ones are &lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executor.html&quot;&gt;Executor&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadFactory.html&quot;&gt;ThreadFactory&lt;/a&gt;, etc. Increasing the scope of what we adapt would allow us to be closer to Java’s support and would expand the scope of where this support can be used.&lt;/p&gt;
&lt;p&gt;Simple example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; Adapt Thread constructor method value to ThreadFactory (not FI)
;; Use the factory to get a Thread with a Runnable and start it
(let [^java.util.concurrent.ThreadFactory tf ^[Runnable] Thread/new]
  (.start 
    (.newThread tf #(println &quot;hi&quot;))))

Execution error (ClassCastException) at user/eval145 (REPL:1).
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;class user$eval145$invoke__Thread_new__149 cannot be cast to class java.util.concurrent.ThreadFactory&lt;/p&gt;
&lt;p&gt;Jira: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2856&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2856&lt;/a&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13908/expand-fi-adapting-to-sam-types-not-marked-as-fi</guid>
<pubDate>Fri, 24 May 2024 12:50:20 +0000</pubDate>
</item>
<item>
<title>Support Clojure 1.12-alpha12 Array class notation</title>
<link>https://ask.clojure.org/index.php/13906/support-clojure-1-12-alpha12-array-class-notation</link>
<description>&lt;p&gt;Currently, the function &lt;code&gt;clojure.tools.reader.impl.commons/parse-symbol&lt;/code&gt; is fairly lax with what it allows, both in general and with regard to the forthcoming Clojure 1.12 Array class notation.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (mapv trc/parse-symbol [&quot;String/1&quot; &quot;String/-1&quot; &quot;String/11&quot; &quot;String/1a&quot;])
[nil [&quot;String&quot; &quot;-1&quot;] nil nil]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is different than the current implementation, which only accepts the first. Is there any interest in updating it to be stricter for the new notation?&lt;/p&gt;
</description>
<category>tools.reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13906/support-clojure-1-12-alpha12-array-class-notation</guid>
<pubDate>Thu, 23 May 2024 19:02:29 +0000</pubDate>
</item>
<item>
<title>Could re-pattern be extended to allow flags?</title>
<link>https://ask.clojure.org/index.php/13894/could-re-pattern-be-extended-to-allow-flags</link>
<description>&lt;p&gt;The JVM method &lt;code&gt;java.util.regex.Pattern&lt;/code&gt; has the option of taking a second parameter for flags, which is a bitwise combination of the various allowed values. Has a similar arity been considered for the &lt;code&gt;clojure.core.re-pattern&lt;/code&gt; function?&lt;/p&gt;
&lt;p&gt;For instance:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def rflags {\i java.util.regex.Pattern/CASE_INSENSITIVE
             \m java.util.regex.Pattern/MULTILINE
             \s java.util.regex.Pattern/DOTALL
             \u java.util.regex.Pattern/UNICODE_CASE
             \d java.util.regex.Pattern/UNIX_LINES
             \x java.util.regex.Pattern/LITERAL
             \c java.util.regex.Pattern/CANON_EQ})
(defn re-flags [s] 
  (reduce bit-or 0 (map #(rflags % 0) s)))

(defn re-pattern
  &quot;Returns an instance of java.util.regex.Pattern, for use, e.g. in
  re-matcher.&quot;
  {:tag java.util.regex.Pattern
   :added &quot;1.0&quot;
   :static true}
  ([s] (re-pattern s 0))
  ([s f] (if (instance? java.util.regex.Pattern s)
          s
          (. java.util.regex.Pattern (compile s f))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Some notes on this:&lt;br&gt;
- Most of these flags can already be added to a pattern today using a &lt;code&gt;?&lt;/code&gt; modifier. For instance, a pattern can be made case insensitive by adding &lt;code&gt;(?i)&lt;/code&gt; to the start of the string. However, allowing a flags string is compatible with JavaScript (and could be implemented on ClojureScript)&lt;br&gt;
- There are currently no options to define LITERAL or CANON_EQ without using &lt;code&gt;java.util.regex.Pattern&lt;/code&gt; directly.&lt;br&gt;
- There is currently no way to implement any flags in ClojureScript without using interop.&lt;br&gt;
- While not all of these flags are compatible with JavaScript, the more common ones are. Similarly, JavaScript allows for flags that are not compatible with Java, so there is already a small disconnect.&lt;br&gt;
- Passing 0 for the default flags is indeed &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/openjdk/jdk/blob/9ca90ccd6bfec76e54e2e870bd706fad5abf233c/src/java.base/share/classes/java/util/regex/Pattern.java#L1101&quot;&gt;what &lt;code&gt;java.util.regex.Pattern(String)&lt;/code&gt; does&lt;/a&gt;.&lt;/p&gt;
</description>
<category>Regex</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13894/could-re-pattern-be-extended-to-allow-flags</guid>
<pubDate>Wed, 22 May 2024 17:02:15 +0000</pubDate>
</item>
<item>
<title>tools.tools install-latest throws sha error with :coord  and never upgrades with :tool</title>
<link>https://ask.clojure.org/index.php/13882/tools-tools-install-latest-throws-error-coord-never-upgrades</link>
<description>&lt;p&gt;Thanks for &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/TDEPS-253&quot;&gt;https://clojure.atlassian.net/browse/TDEPS-253&lt;/a&gt;, however I noticed it doesn't quite work as expected for a fresh install (with &lt;code&gt;:coord&lt;/code&gt;); I get an error due to a missing sha, contrary to the doc string &quot;git coords may omit sha&quot;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Ttools install-latest \
:lib org/tool-name \
:coord '{:git/url &quot;git@gitlab.int.org.com:group/subgroup/tool-name.git&quot;}' \
:as tool-name

=&amp;gt;
Execution error (ExceptionInfo) at clojure.tools.deps.extensions.git/eval1656$fn (git.clj:79).
Library org/tool-name has coord with missing sha
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I also found upgrading a tool with saved coordinates (&lt;code&gt;clj -Ttools install-latest :tool tool-name&lt;/code&gt;) always results in &quot;Skipping, newest installed&quot; (because passing the &lt;code&gt;coord&lt;/code&gt; returned by &lt;code&gt;parse-install-latest-args&lt;/code&gt; to &lt;code&gt;install-1&lt;/code&gt; means &lt;code&gt;ext/find-all-versions&lt;/code&gt; is never evaluated). Looks like this issue would affect tools with auto resolved git urls too.&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13882/tools-tools-install-latest-throws-error-coord-never-upgrades</guid>
<pubDate>Mon, 13 May 2024 10:24:47 +0000</pubDate>
</item>
<item>
<title>`(s/gen ratio?)` throws exceptions</title>
<link>https://ask.clojure.org/index.php/13877/s-gen-ratio-throws-exceptions</link>
<description>&lt;p&gt;&lt;code&gt;(s/gen ratio?)&lt;/code&gt; is &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/spec.alpha/blob/c630a0b8f1f47275e1a476dcdf77507316bad5bc/src/main/clojure/clojure/spec/gen/alpha.clj#L187&quot;&gt;implemented&lt;/a&gt; as &lt;code&gt;(gen/such-that ratio? gen/ratio)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The problem is that about 10% of the time &lt;code&gt;gen/ratio&lt;/code&gt; returns a whole number, which fails the &lt;code&gt;ratio?&lt;/code&gt; predicate. If that happens 10 times in a row, &lt;code&gt;gen/such-that&lt;/code&gt; throws an exception.&lt;/p&gt;
&lt;p&gt;With a large enough sample size, &lt;code&gt;(s/gen ratio?)&lt;/code&gt; reliably fails:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(dorun (gen/sample (s/gen ratio?) 10000000))

Execution error (ExceptionInfo) at clojure.test.check.generators/fn (generators.cljc:435).
Couldn't satisfy such-that predicate after 10 tries.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A quick fix is to increase the &lt;code&gt;max-tries&lt;/code&gt; param for &lt;code&gt;such-that&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(dorun (gen/sample (gen/such-that ratio? gen/ratio 100) 10000000))

=&amp;gt; nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I do however also find it odd that &lt;code&gt;(s/gen ratio?)&lt;/code&gt; always generates &lt;code&gt;Ratio&lt;/code&gt;s, but &lt;code&gt;gen/ratio&lt;/code&gt; generates a mixture of ratios and integers. So perhaps a better fix would be to update &lt;code&gt;gen/ratio&lt;/code&gt; to not generate integers?&lt;/p&gt;
</description>
<category>Spec</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13877/s-gen-ratio-throws-exceptions</guid>
<pubDate>Wed, 08 May 2024 07:44:49 +0000</pubDate>
</item>
<item>
<title>Request: def should infer type tag where possible</title>
<link>https://ask.clojure.org/index.php/13872/request-def-should-infer-type-tag-where-possible</link>
<description>&lt;p&gt;Maybe there’s a good reason why it doesn’t, but it seems to me it would be great if def would automatically infer type hint:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [s &quot;abc&quot;]
  (.chars s)) ;; all fine, no warning

(def s &quot;abc&quot;)

(.chars s) ;; Reflection warning, null:21:0 - reference to field chars can't be resolved.

(meta #'s) ;; ↓ notice -- no tag
;; {:line 19,
;;  :column 0,
;;  :file &quot;NO_SOURCE_FILE&quot;,
;;  :name s,
;;  :ns #object[clojure.lang.Namespace 0x78068afb &quot;user&quot;]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Related jira: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2851&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2851&lt;/a&gt;&lt;br&gt;
Related question: &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/9167/infer-hint-from-return-type-hint-function-call-initializes&quot;&gt;https://ask.clojure.org/index.php/9167/infer-hint-from-return-type-hint-function-call-initializes&lt;/a&gt;&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13872/request-def-should-infer-type-tag-where-possible</guid>
<pubDate>Fri, 03 May 2024 20:01:21 +0000</pubDate>
</item>
<item>
<title>Why does compilation of fn fail when referencing a class with a failing static field initializer?</title>
<link>https://ask.clojure.org/index.php/13810/compilation-referencing-class-failing-static-initializer</link>
<description>&lt;p&gt;Given a Clojure function which references a class, if that class has a static field with an initializer which fails when run, the function will fail to compile because the compiler (needlessly) runs the initializer even if the respective field is not accessed. Notably, this does &lt;em&gt;not&lt;/em&gt; happen when storing the class in a var and then referencing it through that instead (see workaround below). Could the compiler support the direct reference here?&lt;/p&gt;
&lt;h2&gt;Reproducer&lt;/h2&gt;
&lt;p&gt;(The following code is also available at &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/bevuta/clojure-fn-compilation-issue-repro&quot;&gt;https://github.com/bevuta/clojure-fn-compilation-issue-repro&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;deps.edn&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:deps {io.netty/netty-codec {:mvn/version &quot;4.1.108.Final&quot;}}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;src/repro/fail.clj&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns repro.fail
  (:import io.netty.handler.codec.compression.BrotliOptions))

(defn bar []
  BrotliOptions)

(defn -main [&amp;amp; args]
  (prn (bar)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here, the &lt;code&gt;bar&lt;/code&gt; function references the &lt;code&gt;io.netty.handler.codec.compression.BrotliOptions&lt;/code&gt; class. That class has &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/netty/netty/blob/c1d0fd2dbf7907a99ab702795e35d9de8068c1cb/codec/src/main/java/io/netty/handler/codec/compression/BrotliOptions.java#L32-L34&quot;&gt;a package-private static field named &lt;code&gt;DEFAULT&lt;/code&gt;&lt;/a&gt; with an initializer. That initializer depends on a class which is provided by an optional third-party library. However, even though &lt;code&gt;bar&lt;/code&gt; never references that field, the initializer gets run and fails because that library is not present.&lt;/p&gt;
&lt;p&gt;Run it like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -M -m repro.fail
Execution error (ClassNotFoundException) at jdk.internal.loader.BuiltinClassLoader/loadClass (BuiltinClassLoader.java:641).
com.aayushatharva.brotli4j.encoder.Encoder$Parameters
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Workaround&lt;/h2&gt;
&lt;p&gt;The issue can be worked around by putting the class value into a separate &lt;code&gt;def&lt;/code&gt; and using that in the function instead:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;src/repro/ok.clj&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns repro.ok
  (:import io.netty.handler.codec.compression.BrotliOptions))

(def foo BrotliOptions)

(defn bar []
  foo)

(defn -main [&amp;amp; args]
  (prn (bar)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run it like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -M -m repro.ok
io.netty.handler.codec.compression.BrotliOptions
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Relevance&lt;/h2&gt;
&lt;p&gt;The issue was encountered in the context of &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clj-commons/aleph/issues/703&quot;&gt;https://github.com/clj-commons/aleph/issues/703&lt;/a&gt;&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13810/compilation-referencing-class-failing-static-initializer</guid>
<pubDate>Mon, 08 Apr 2024 15:01:01 +0000</pubDate>
</item>
<item>
<title>java.lang.NoClassDefFoundError: java/util/SequencedCollection</title>
<link>https://ask.clojure.org/index.php/13748/java-lang-noclassdeffounderror-java-sequencedcollection</link>
<description>&lt;p&gt;Compiling a deftype that implements List on Java 21 will create a class that includes a reference to the (new to Java 21) SequencedCollection type (which introduces a new method &lt;code&gt;reverse&lt;/code&gt;). Loading the compiled class will throw in an older Java runtime as the SequencedCollection type doesn't exist.&lt;/p&gt;
&lt;p&gt;Given repro.clj:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns repro)

(deftype C []
  java.util.List)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Compiling with Java 21 JDK to a class, javap shows:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public final class repro.C implements java.util.List,clojure.lang.IType {
  public repro.C();
    Code:
       0: aload_0
       1: invokespecial #13  // Method java/lang/Object.&quot;&amp;lt;init&amp;gt;&quot;:()V
       4: return

  public static clojure.lang.IPersistentVector getBasis();
    Code:
       0: invokestatic  #20  // Method clojure/lang/Tuple.create:()Lclojure/lang/IPersistentVector;
       3: areturn

  public java.util.SequencedCollection reversed();
    Code:
       0: aload_0
       1: invokeinterface #25,  1   // InterfaceMethod java/util/List.reversed:()Ljava/util/List;
       6: areturn

  public static {};
    Code:
       0: return
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Loading this class in Clojure with an older Java version throws:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (require 'repro)
Execution error (ClassNotFoundException) at jdk.internal.loader.BuiltinClassLoader/loadClass (BuiltinClassLoader.java:641).
java.util.SequencedCollection
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;List includes a default &lt;code&gt;reversed()&lt;/code&gt; method implementation for the &lt;code&gt;SequenceCollection&lt;/code&gt; parent interface. Not sure why this forwarding method is getting created here but it's presumably different than others because it's a parent default method impl that we're forwarding to.&lt;/p&gt;
</description>
<category>Records and Types</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13748/java-lang-noclassdeffounderror-java-sequencedcollection</guid>
<pubDate>Wed, 21 Feb 2024 03:29:09 +0000</pubDate>
</item>
<item>
<title>Option in `clojure` CLI command to print the basis</title>
<link>https://ask.clojure.org/index.php/13739/option-in-clojure-cli-command-to-print-the-basis</link>
<description>&lt;p&gt;It would be nice that &lt;code&gt;clojure&lt;/code&gt; could print the basis for a given combination of aliases (or none).&lt;/p&gt;
&lt;p&gt;A common use case is obtaining the computed &lt;code&gt;:paths&lt;/code&gt; for a combination of aliases.&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13739/option-in-clojure-cli-command-to-print-the-basis</guid>
<pubDate>Thu, 15 Feb 2024 13:57:44 +0000</pubDate>
</item>
<item>
<title>spec for extend-protocol</title>
<link>https://ask.clojure.org/index.php/13723/spec-for-extend-protocol</link>
<description>&lt;p&gt;Many macros in clojure have a spec which get executed by the compiler at macro-expansion time.&lt;/p&gt;
&lt;p&gt;At this time &lt;code&gt;extend-protocol&lt;/code&gt; doesn't have such a spec.&lt;br&gt;
I'd like to know if &lt;code&gt;extend-protocol&lt;/code&gt; is supposed to work with &lt;code&gt;(Class/forName ..)&lt;/code&gt; or that the class name to which the protocol is extended must always be a symbol. A spec would be the natural place to get this answer from. &lt;code&gt;extend-protocol&lt;/code&gt; is known to not work with &lt;code&gt;Class/forName&lt;/code&gt; when you provide more than one:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(extend-protocol IFoo (Class/forName &quot;[B&quot;) (Class/forName &quot;[D&quot;))
Syntax error (IllegalArgumentException) compiling at (REPL:1:1).
Don't know how to create ISeq from: java.lang.Character&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If the spec says anything about this, I can also make linting for this in clj-kondo. At this time it seems to be ambiguous: &lt;code&gt;(extend-protocol IFoo (Class/forName &quot;[B&quot;))&lt;/code&gt; does work.&lt;/p&gt;
&lt;p&gt;Related issue: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-1381&quot;&gt;https://clojure.atlassian.net/browse/CLJ-1381&lt;/a&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13723/spec-for-extend-protocol</guid>
<pubDate>Wed, 14 Feb 2024 14:05:57 +0000</pubDate>
</item>
<item>
<title>Does `:exclude` need to be added to https://clojuredocs.org/clojure.core/require ?</title>
<link>https://ask.clojure.org/index.php/13714/does-exclude-need-added-https-clojuredocs-clojure-require</link>
<description>&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojuredocs.org/clojure.core/require&quot;&gt;https://clojuredocs.org/clojure.core/require&lt;/a&gt; makes no mention of &lt;code&gt;:exclude&lt;/code&gt; but this seems to work as it appears:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[clojure.set :refer :all :exclude [join rename]])
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13714/does-exclude-need-added-https-clojuredocs-clojure-require</guid>
<pubDate>Tue, 13 Feb 2024 19:29:06 +0000</pubDate>
</item>
<item>
<title>Should 'method value' error messages (wrong arity) special case for constructors?</title>
<link>https://ask.clojure.org/index.php/13707/should-method-value-error-messages-wrong-special-constructors</link>
<description>&lt;p&gt;If I call a method with the wrong number of arguments, I get a concise, descriptive error message:&lt;br&gt;
&lt;code&gt;(^[] String/toUpperCase &quot;foo&quot; 2)
Syntax error...
Invocation of method toUpperCase in class java.lang.String expected 0 arguments, but received 1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If I call a constructor with the wrong number of arguments, I get a very similar message:&lt;br&gt;
&lt;code&gt;(^[String] String/new &quot;foo&quot; 2)
Syntax error...
Invocation of method java.lang.String in class java.lang.String expected 1 arguments, but received 2&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This message refers to the class name as the method, which feels like what you might get for a constructor.&lt;/p&gt;
&lt;p&gt;I noticed that if my param-tags are incorrect on a constructor, the wording of the message is slightly different (&quot;Expected to find 1 matching signature for &lt;em&gt;constructor&lt;/em&gt;&quot; as opposed to &quot;for &lt;em&gt;method&lt;/em&gt;&quot;), so I just want to pose the question while these messages are somewhat fresh: Should the wording for the arity message mention 'constructor' or 'String/new' or something along those lines?&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13707/should-method-value-error-messages-wrong-special-constructors</guid>
<pubDate>Mon, 12 Feb 2024 23:36:52 +0000</pubDate>
</item>
</channel>
</rss>