<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged request</title>
<link>https://ask.clojure.org/index.php/tag/request</link>
<description></description>
<item>
<title>Feature Request:Make anonymous fn/reify class name IDs per namespace instead of one global counter</title>
<link>https://ask.clojure.org/index.php/14935/feature-request-anonymous-namespace-instead-global-counter</link>
<description>&lt;p&gt;  Compiled anonymous functions and reify classes get names like ns$fn__4532, where the numeric suffix comes from a global AtomicInteger counter&lt;br&gt;
  (RT.nextID()).&lt;/p&gt;
&lt;p&gt; This counter is shared across the entire runtime and is consumed by fn classes, reify classes, constants tables, gensyms, etc.&lt;/p&gt;
&lt;p&gt;  The problem is that because the counter is global, any code change shifts the IDs for everything compiled after it. This makes profiling across builds&lt;br&gt;
  really painful, you can't meaningfully compare flame graphs because all the class names change even in code you didn't touch.&lt;/p&gt;
&lt;p&gt;  I'd like to propose scoping the ID counter per-namespace instead. Since the namespace is already part of the class name prefix, uniqueness is still&lt;br&gt;
  guaranteed. This would eliminate the cascading effect across unchanged namespaces and make profiling diffs actually useful.&lt;/p&gt;
&lt;p&gt;I'm not sure what's the downsides of this, but from what I saw of AtomicInteger, it isn't used a lot to break things.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14935/feature-request-anonymous-namespace-instead-global-counter</guid>
<pubDate>Wed, 18 Feb 2026 15:34:38 +0000</pubDate>
</item>
<item>
<title>Core Cache and Count</title>
<link>https://ask.clojure.org/index.php/14910/core-cache-and-count</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I notice that in the wrapped namespace of core.cache, there is a &lt;strong&gt;has?&lt;/strong&gt; function that checks the wrapped cache if it has an element or not. It does this by delegating to the underlying cache &lt;strong&gt;c/has?&lt;/strong&gt; function of the wrapped cache.&lt;/p&gt;
&lt;p&gt;For reporting purposes, I need to get the current size of the cache (with the caveat of course that the size could be approximate, given the particular nature of a particular cache - but approximation is fine).&lt;/p&gt;
&lt;p&gt;Unfortuantely, a &lt;strong&gt;size&lt;/strong&gt; or &lt;strong&gt;count&lt;/strong&gt; function doesn't exist in the wrapped namespace, it only exists on the wrapped cache itself - thus doing:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(count @wrapped-cache)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; does return the value. &lt;/p&gt;
&lt;p&gt;It would be good, however,  if there was also a similar function in the wrapped namespace, something like this (using &lt;strong&gt;size&lt;/strong&gt; as the function name, but could be something else):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn size
   [cache-atom]
   (c/count @cache-atom)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The rationale being that having this function exposed in the wrapped namespace keeps the code consistent - i.e., whilst I can continue to do:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(count @wrapped-cache)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It would more preferrable to keep using the wrapped namespace (as I do with other operations, such as evict), i.e., something along the lines of:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(wrapped/size wrapped-cache)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Do you think this suggestion might be something that could be included in the wrapped namespace?&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt;-=david=-&lt;/p&gt;
</description>
<category>core.cache</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14910/core-cache-and-count</guid>
<pubDate>Wed, 28 Jan 2026 16:54:22 +0000</pubDate>
</item>
<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>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>Support for automatic promotion to BigDecimal in +', *', etc.</title>
<link>https://ask.clojure.org/index.php/14752/support-for-automatic-promotion-to-bigdecimal-in-etc</link>
<description>&lt;p&gt;Is there support for BigDecimal promotion in the &lt;code&gt;+'&lt;/code&gt;, &lt;code&gt;*'&lt;/code&gt;, etc. &lt;code&gt;clojure.core&lt;/code&gt; functions?&lt;/p&gt;
&lt;p&gt;When I run the following code in the REPL:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(* 2 Double/MAX_VALUE)     ;; ##Inf, Doesn't auto-promote as was expected.
(*' 2 Double/MAX_VALUE)    ;; ##Inf, Expected that it would auto promote.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Following cases also didn't work:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(*' Double/MAX_VALUE 2)        ;; ##Inf, Moving around the arguments.
(*' 2.0 Double/MAX_VALUE)      ;; ##Inf, Using a Double literal instead.
(*' Double/MAX_VALUE 2.0)      ;; ##Inf
(*' Double/MAX_VALUE 2.0M)     ;; ##Inf, Using a BigDecimal literal instead.
(*' 2.0M Double/MAX_VALUE)     ;; ##Inf
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I decided to check the Clojure compiler source for promotion, and based on my limited understanding of the code I see that &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L634&quot;&gt;DoubleOps&lt;/a&gt; is using the implementation of &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L76&quot;&gt;addP&lt;/a&gt; of &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L75&quot;&gt;OpsP&lt;/a&gt; abstract class (which just calls the normal &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L671&quot;&gt;add&lt;/a&gt; function)  while there is one present for &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L449&quot;&gt;LongOps&lt;/a&gt; which can be found &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L494&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Is this a bug? And if yes, I would like to work on the fix and I'll check the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/dev/dev&quot;&gt;Development&lt;/a&gt; page of Clojure to do the needfull.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14752/support-for-automatic-promotion-to-bigdecimal-in-etc</guid>
<pubDate>Mon, 10 Nov 2025 04:15:47 +0000</pubDate>
</item>
<item>
<title>Can doc and jdoc be refactored to a common protocol while it's still early?</title>
<link>https://ask.clojure.org/index.php/14734/can-doc-and-jdoc-refactored-common-protocol-while-still-early</link>
<description>&lt;p&gt;A fresh clojure library clojure.java.doc introduces some nice functions for querying javadoc.&lt;br&gt;
It all seems nice and useful, I really can't complain (nor this is high priority to me since Javadoc is usually so verbose that I would probably continue to read it in the Web browser unless I discover use cases where REPL access is more practical to me).&lt;/p&gt;
&lt;p&gt;However, one thing that struck my mind, and I had to ask is this: why introduce new functions, such as jdoc? Wouldn't it be more convenient to introduce a protocol (say, doc) which could then be extended to support&lt;br&gt;
1. original Clojure doc&lt;br&gt;
2. Javadoc&lt;br&gt;
3. some sort of javascript doc, if that exists&lt;br&gt;
4. C# doc&lt;br&gt;
5. Native libraries doc, etc.&lt;/p&gt;
&lt;p&gt;I understand that doc is a part of Clojure core, which you avoid changing at any costs, but this protocol wouldn't have to touch it.&lt;/p&gt;
&lt;p&gt;It could simply be a &quot;replacement&quot; from the new namespace, which would have one implementation that invokes doc, but also be open to other implementations, such as jdoc.&lt;/p&gt;
&lt;p&gt;And I understand that for Clojure core it's an absolute priority to not even change a formatting of the source code unless it's absolutely necessary, to keep very detailed compilation behavior or whatnot. It's a choice you made, it has its traidoffs, you chose those, and that's it. But, are those tradeoffs the same for namespaces such as clojure.repl and functions such as doc?&lt;/p&gt;
</description>
<category>java.doc</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14734/can-doc-and-jdoc-refactored-common-protocol-while-still-early</guid>
<pubDate>Tue, 28 Oct 2025 11:41:48 +0000</pubDate>
</item>
<item>
<title>Allocation churn on generators</title>
<link>https://ask.clojure.org/index.php/14721/allocation-churn-on-generators</link>
<description>&lt;p&gt;When generating moderately large values there is some LazySeq churn that could be avoided. For example, the following snippet allocates over 15GB (measured with async-profiler):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(core/let [g (vector (not-empty string-alphanumeric) 1000 5000)]
  (time
   (dotimes [seed 50]
     (dorun (generate g 100 seed)))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The pattern of generating multiple (increasingly larger) values is common with quick-check (via deftest et al).&lt;/p&gt;
&lt;p&gt;Many generators are built on top of &lt;code&gt;choose&lt;/code&gt;, and there is an opportunity to reduce churn by special casing &lt;code&gt;shrink-int&lt;/code&gt; for longs (which should be the common case compared to big ints).&lt;/p&gt;
&lt;p&gt;I have a patch that decreases total allocations of the repro above by ~15% and speed up the run time by ~25% (measured on jdk 25, with &lt;code&gt;-Xmx512m -XX:+UseSerialGC&lt;/code&gt; to decrease variance). Happy to share it.&lt;/p&gt;
</description>
<category>test.check</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14721/allocation-churn-on-generators</guid>
<pubDate>Tue, 07 Oct 2025 21:16:10 +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>How to pipe with clojure.java.process?</title>
<link>https://ask.clojure.org/index.php/14609/how-to-pipe-with-clojure-java-process</link>
<description>&lt;p&gt;I'm sure this is embarrassingly simple, but I can't seem to figure out how to pipe stdout to stdin with clojure.java.process.&lt;/p&gt;
&lt;p&gt;With clojure.java.shell, I could do something like&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(sh &quot;cat&quot; &quot;-&quot; :in (:out (sh &quot;echo&quot; &quot;hi&quot;)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I realize this is an indirect way to handle this since it's blocking and is handling everything as strings instead of native Java objects.&lt;/p&gt;
&lt;p&gt;With clojure.java.process, I could do something like &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(exec &quot;bash&quot; &quot;-c&quot; &quot;echo hi | cat -&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but that's just using Bash.&lt;/p&gt;
&lt;p&gt;I know there are other, third-party libraries such as Babashka/process and Raynes/conch, but I'd like to learn how to do this with the new Clojure library.&lt;/p&gt;
&lt;p&gt;My instinct was to try&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(exec {:in (stdout (start &quot;echo&quot; &quot;hi&quot;))} &quot;cat&quot; &quot;-&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or something to that effect, but it doesn't work.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14609/how-to-pipe-with-clojure-java-process</guid>
<pubDate>Fri, 04 Jul 2025 21:32:20 +0000</pubDate>
</item>
<item>
<title>`create-basis` silently accepts missing aliases</title>
<link>https://ask.clojure.org/index.php/14584/create-basis-silently-accepts-missing-aliases</link>
<description>&lt;p&gt;In &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojars/clojars-web/commit/baade8967c7be8abd9a9b27499c511efd41f6164&quot;&gt;this scenario&lt;/a&gt;, the alias for &lt;code&gt;create-basis&lt;/code&gt; was incorrect, preventing security deps overrides from being applied. For 2 years clojars was deployed with these vulnerable deps.&lt;/p&gt;
&lt;p&gt;In this case, I proposed &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojars/clojars-web/pull/906&quot;&gt;to inline the alias&lt;/a&gt; into &lt;code&gt;:deps&lt;/code&gt;. However there may be other scenarios where a tools.deps change might be helpful to catch these mistakes earlier, for example a warning or error.&lt;/p&gt;
</description>
<category>tools.deps</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14584/create-basis-silently-accepts-missing-aliases</guid>
<pubDate>Tue, 10 Jun 2025 00:57:37 +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>`merge-with` doesn´t treat pair (vectors of 2) the same way `merge` does</title>
<link>https://ask.clojure.org/index.php/14529/merge-with-doesnt-treat-pair-vectors-the-same-way-merge-does</link>
<description>&lt;pre&gt;&lt;code&gt;;; merge
(merge {:a :b} [:a :c]) ;=&amp;gt; {:a :c}

;; merge-with
(merge-with (fn [_ x] x) {} {:a :b} [:a :c])
;; =&amp;gt; class clojure.lang.Keyword cannot be cast to class java.util.Map$Entry
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think this happens because &lt;code&gt;merge-with&lt;/code&gt; eventually &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3090&quot;&gt;calls &lt;code&gt;seq&lt;/code&gt; on the &quot;Map&quot;&lt;/a&gt;, expecting to get a &quot;Map Entry&quot; from which then it can extracts &lt;code&gt;key&lt;/code&gt; and &lt;code&gt;value&lt;/code&gt;, and fails when receiving a Vector, because &lt;code&gt;seq&lt;/code&gt; will just yield one element at a time:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(key (first (seq {:a :c}))) ;; =&amp;gt; :a
(key (first (seq [:a :c])))
;; =&amp;gt; class clojure.lang.Keyword cannot be cast to class java.util.Map$Entry
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think it is justified to expect that &lt;code&gt;(partial merge-with (fn [_ x] x))&lt;/code&gt; should behave exactly as &lt;code&gt;merge&lt;/code&gt; and my proposal is to make it happen, if what I described makes sense.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
</description>
<category>Collections</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14529/merge-with-doesnt-treat-pair-vectors-the-same-way-merge-does</guid>
<pubDate>Thu, 01 May 2025 11:25:20 +0000</pubDate>
</item>
<item>
<title>tools.cli: Support default value for arg with value</title>
<link>https://ask.clojure.org/index.php/14524/tools-cli-support-default-value-for-arg-with-value</link>
<description>&lt;p&gt;I would like to have a &lt;code&gt;--diff&lt;/code&gt; flag which defaults to &lt;code&gt;origin/HEAD&lt;/code&gt; but allow pass a different rev in the arg, like &lt;code&gt;--diff origin/bar&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Context: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1KBA2/p1745859358672599&quot;&gt;https://clojurians.slack.com/archives/C03S1KBA2/p1745859358672599&lt;/a&gt;&lt;/p&gt;
</description>
<category>tools.cli</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14524/tools-cli-support-default-value-for-arg-with-value</guid>
<pubDate>Mon, 28 Apr 2025 17:21:53 +0000</pubDate>
</item>
<item>
<title>regular expression with Classes for Unicode scripts, blocks, categories and binary properties</title>
<link>https://ask.clojure.org/index.php/14513/regular-expression-classes-unicode-categories-properties</link>
<description>&lt;p&gt;In Clojure, the following expression works fine:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(re-matches #&quot;\p{Lu}&quot; &quot;Á&quot;) ;; =&amp;gt; &quot;Á&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But in Clojurescript, it returns &lt;code&gt;nil&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It is not that Javascript doesn't support that kind of Unicode classess, but you have to activate them explicitly, whether in Java, they are activated by default.&lt;/p&gt;
&lt;p&gt;E.g. In Javascript, the following code returns true:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/\p{Lu}/u.test(&quot;Á&quot;) // =&amp;gt; true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But if I omit the Unicode flag (&lt;code&gt;/u&lt;/code&gt;) I get false:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/\p{Lu}/.test(&quot;Á&quot;) // =&amp;gt; false
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think this is probably because Clojure Script doesn't activates the Unicode flag for us.&lt;/p&gt;
&lt;p&gt;If that the case, I think consistency between Clojurescript and Clojure could benefit a lot if the flag is activated by default.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14513/regular-expression-classes-unicode-categories-properties</guid>
<pubDate>Tue, 22 Apr 2025 15:39:14 +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>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>Do stream interop functions close the stream?</title>
<link>https://ask.clojure.org/index.php/14376/do-stream-interop-functions-close-the-stream</link>
<description>&lt;p&gt;Docs for the handy new stream interop functions (&lt;code&gt;stream-seq!&lt;/code&gt;, &lt;code&gt;stream-into!&lt;/code&gt; etc) say they &quot;are terminal stream operations (they consume the stream).&quot;&lt;/p&gt;
&lt;p&gt;Just to be totally clear, does this mean they close (&lt;code&gt;.close&lt;/code&gt;) the streams?&lt;/p&gt;
&lt;p&gt;I ask because I use these functions with the stream returned from &lt;code&gt;java.nio.file.Files/list&lt;/code&gt; and when I'm benchmarking the app I sometimes get &quot;too many open files&quot; Java errors. I can't think where else I might conceivably be leaving a file handle open, beyond that I'm almost entirely just using &lt;code&gt;slurp&lt;/code&gt; (for now at least).&lt;/p&gt;
&lt;p&gt;(Naively, I would expect everything except &lt;code&gt;stream-seq!&lt;/code&gt; to close out the stream by the time it returns, and &lt;code&gt;stream-seq!&lt;/code&gt; I would expect to close once the seq is consumed and/or garbage collected)&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14376/do-stream-interop-functions-close-the-stream</guid>
<pubDate>Sat, 08 Feb 2025 16:23:45 +0000</pubDate>
</item>
<item>
<title>Could we have a msg arg to time?</title>
<link>https://ask.clojure.org/index.php/14350/could-we-have-a-msg-arg-to-time</link>
<description>&lt;p&gt;Very handy in CLJC projects especially to log long running operations. Happy to do PR(s).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  [expr msg]
  `(let [start# (. System (nanoTime))
         ret# ~expr]
     (prn (str msg (/ (double (- (. System (nanoTime)) start#)) 1000000.0) &quot; msecs&quot;))
     ret#))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Even better would be fmt-msg.  (format msg-msg (/ (double (- (. System (nanoTime)) start#)) 1000000.0))&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14350/could-we-have-a-msg-arg-to-time</guid>
<pubDate>Wed, 22 Jan 2025 21:03:28 +0000</pubDate>
</item>
<item>
<title>Incorrect docstring for parse-opts</title>
<link>https://ask.clojure.org/index.php/14275/incorrect-docstring-for-parse-opts</link>
<description>&lt;p&gt;In the docstring for &lt;code&gt;clojure.tools.cli/parse-opts&lt;/code&gt; (seen &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.github.io/tools.cli/#clojure.tools.cli/parse-opts&quot;&gt;here&lt;/a&gt;), it says,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:id           The key for this option in the resulting option map. This
              is normally set to the keywordized name of the long option
              without the leading dashes.

              Multiple option entries can share the same :id in order to
              transform a value in different ways, but only one of these
              option entries may contain a :default(-fn) entry.

              This option is mandatory.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The final line says &quot;This option is mandatory.&quot; which is technically true for parse-opts' internals, but it's not true for users because (as the first paragraph says) &lt;code&gt;:id&lt;/code&gt; is also generated by keywordizing the long option.&lt;/p&gt;
&lt;p&gt;May I recommend changing it to be more explicit? Something like &quot;If a long option is not provided, this option is mandatory.&quot;&lt;/p&gt;
</description>
<category>tools.cli</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14275/incorrect-docstring-for-parse-opts</guid>
<pubDate>Tue, 03 Dec 2024 16:02:27 +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>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>Could clojure.java.process support more convenient interactive usage?</title>
<link>https://ask.clojure.org/index.php/14097/could-clojure-process-support-convenient-interactive-usage</link>
<description>&lt;p&gt;I've been using clojure.java.process from the Clojure 1.12 RCs a lot and it's great having that functionality built right in to clojure.&lt;/p&gt;
&lt;p&gt;I frequently find myself wanting a fully interactive process that blocks until exit. For example&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[clojure.java.process :as p])
(let [p (p/start
            {:in  :inherit
             :out :inherit
             :err :inherit}
            &quot;bash&quot;)]
    @(p/exit-ref p))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Having your repl become a bash shell is an extreme (but often useful) example. More frequently you might want to just call a script that has a yes or no prompt. During development and repl usage it's also a convenient default, in cases you hit some user input prompt you didn't expect and can now just answer in the repl.&lt;/p&gt;
&lt;p&gt;Could it be worth it to add some means to support this to the clojure.java.process namespace? &lt;/p&gt;
&lt;p&gt;Related: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Java's ProcessBuilder has &lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.oracle.com/javase/9/docs/api/java/lang/ProcessBuilder.html#inheritIO--&quot;&gt;inheritIO&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/babashka/process&quot;&gt;babashka.process&lt;/a&gt; has the ability to set &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/babashka/process/blob/master/src/babashka/process.cljc#L462&quot;&gt;&lt;code&gt;:inherit&lt;/code&gt; to true&lt;/a&gt; to set all io options as well as the &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/babashka/process/blob/689ab390211a854f7427a9976ba526618d60d0cf/src/babashka/process.cljc#L645-L679&quot;&gt;shell&lt;/a&gt; function.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Of course this I could easily use my own helper function for this or just use babashka.process instead. But I am contending that having such usage conveniently supported out of the box perhaps might get a lot of &quot;bang for the buck&quot;.&lt;/p&gt;
&lt;p&gt;A counterpoint is that this is one of numerous things that could be added to that namespace. There are tons of ways people might want to work with processes and clearly clojure.java.process shouldn't try to maximize convenience for every single one of them.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14097/could-clojure-process-support-convenient-interactive-usage</guid>
<pubDate>Fri, 30 Aug 2024 14:20:57 +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>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>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>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>clojuredoc sort is wrong with respect to comparator</title>
<link>https://ask.clojure.org/index.php/13822/clojuredoc-sort-is-wrong-with-respect-to-comparator</link>
<description>&lt;p&gt;The clojuredoc for sort says:&lt;br&gt;
&lt;code&gt;comparator MUST implement java.util.Comparator.&lt;/code&gt;&lt;br&gt;
However, this does not seem to be the case.  The function provided as 1nd argument to 2-ary &lt;code&gt;sort&lt;/code&gt; may return explicitly &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;; it need not implement &lt;code&gt;java.util.Comparator&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It would be nice if the clojuredoc were updated to reflect this important feature.&lt;/p&gt;
&lt;p&gt;There is another document &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/guides/comparators&quot;&gt;https://clojure.org/guides/comparators&lt;/a&gt; which explains in greater detail.  But the existence of that document does not obviate (in my opinion) the short doc from being correct even if incomplete.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13822/clojuredoc-sort-is-wrong-with-respect-to-comparator</guid>
<pubDate>Fri, 19 Apr 2024 09:51:42 +0000</pubDate>
</item>
<item>
<title>Could clojure.core/slurp support sun.nio.fs.UnixPath as its argument?</title>
<link>https://ask.clojure.org/index.php/13808/could-clojure-core-slurp-support-sun-nio-unixpath-argument</link>
<description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;I use &lt;code&gt;babashka.fs/glob&lt;/code&gt; a lot. It returns a sequence of matches, where each match is a &lt;code&gt;sun.nio.fs.UnixPath&lt;/code&gt;. Example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[babashka.fs :as fs])
(fs/glob &quot;.&quot; &quot;*.edn&quot;)
;; =&amp;gt; [#object[sun.nio.fs.UnixPath 0x7d586fe1 &quot;deps.edn&quot;]
;;     #object[sun.nio.fs.UnixPath 0x6b25665b &quot;bb.edn&quot;]]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I often want to read these files. I often try the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(-&amp;gt;&amp;gt; (fs/glob &quot;.&quot; &quot;*.edn&quot;)
    (map slurp))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;, before I remember that doesn't work, so I do this instead:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(-&amp;gt;&amp;gt; (fs/glob &quot;.&quot; &quot;*.edn&quot;)
    (map fs/file)
    (map slurp))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;. So I would think it would be nice if &lt;code&gt;clojure.core/slurp&lt;/code&gt; could support an input argument of type &lt;code&gt;sun.nio.fs.UnixPath&lt;/code&gt;.&lt;/p&gt;
</description>
<category>IO</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13808/could-clojure-core-slurp-support-sun-nio-unixpath-argument</guid>
<pubDate>Sun, 07 Apr 2024 13:27:34 +0000</pubDate>
</item>
<item>
<title>Combining :exec-args from multiple aliases with user-defined semantics</title>
<link>https://ask.clojure.org/index.php/13800/combining-exec-args-from-multiple-aliases-defined-semantics</link>
<description>&lt;p&gt;I was looking for a way to invoke an nREPL server using &lt;code&gt;clojure -X&lt;/code&gt; and specify extra dependencies and middleware in separate aliases which would be composed together on the command line. &lt;/p&gt;
&lt;p&gt;For context: nREPL middleware are specified as a list of functions/runtime-resolved symbols, so ideally there would be some mechanism for each alias in the deps.edn to specify their own vector-of-middleware and have them concatenated in the order which the aliases were listed on the command line. (See below for concrete demonstration of this) &lt;/p&gt;
&lt;p&gt;Unfortunately I couldn't find a satisfactory way of achieving this via the clojure CLI - the issue is that  &lt;code&gt;:exec-args&lt;/code&gt; maps from different aliases are simply merged, with latter values overriding earlier ones.  The clojure.org reference mentions deep merging but this appears to be a doc error. &lt;/p&gt;
&lt;p&gt;(Note that the widespread use of  &lt;code&gt;-M&lt;/code&gt; for this use case does not afford any way of composing command-line string args, forcing each alias to couple together all middleware and dependencies.)&lt;/p&gt;
&lt;p&gt;Of course there shouldn't exist some magic set of semantics for merging &lt;code&gt;exec-arg&lt;/code&gt; values (vectors =&amp;gt; concat, maps =&amp;gt; merge etc.)... Nevertheless there might be a usability gap to fill here, letting users specify their own merging semantics declaratively rather than having to resort to custom-coded task runners .&lt;/p&gt;
&lt;p&gt;An example of how this would look like from the command line, given &lt;code&gt;concat&lt;/code&gt; semantics for the &lt;code&gt;:middleware&lt;/code&gt; arg:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -X:nrepl
Starting nREPL server with: nil

$ clojure -X:nrepl :port 1234
Starting nREPL server with: {:port 1234}

$ clojure -X:cider:nrepl :port 5678
Starting nREPL server with: {:port 5678 :middleware [cider.nrepl/cider-middleware]}

$ clojure -X:portal:cider:nrepl
Starting nREPL server with: {:middleware [portal.nrepl/wrap-portal, cider.nrepl/cider-middleware]}

$ clojure -X:cider:cljr:portal:nrepl
Starting nREPL server with: {:middleware [cider.nrepl/cider-middleware, refactor-nrepl.middleware/wrap-refactor, portal.nrepl/wrap-portal]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;see this conversation in Slack thread for more context:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C6QH853H8/p1711461045176759&quot;&gt;https://clojurians.slack.com/archives/C6QH853H8/p1711461045176759&lt;/a&gt;&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13800/combining-exec-args-from-multiple-aliases-defined-semantics</guid>
<pubDate>Wed, 27 Mar 2024 12:32:27 +0000</pubDate>
</item>
<item>
<title>Warn about user.clj during build compilation</title>
<link>https://ask.clojure.org/index.php/13770/warn-about-user-clj-during-build-compilation</link>
<description>&lt;p&gt;We’ve had a few cases where people encountered issues due to the existence of user.clj during uberjar building with tools.build. &lt;/p&gt;
&lt;p&gt;Because user loads early, anything it loads is not (typically) reloaded during compilation, which can lead to some namespaces not being compiled.&lt;/p&gt;
&lt;p&gt;Should maybe warn if user is on classpath or even actively recompile with something like &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(binding [*compile-files* true] (require 'user :reload-all))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>tools.build</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13770/warn-about-user-clj-during-build-compilation</guid>
<pubDate>Wed, 28 Feb 2024 13:20:46 +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>Support for js/BigInt</title>
<link>https://ask.clojure.org/index.php/13676/support-for-js-bigint</link>
<description>&lt;p&gt;Native support for BigInt in JavaScript has been around since 2020. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt&lt;/a&gt;) &lt;/p&gt;
&lt;p&gt;Any chance of support for this in ClojureScript any time soon?&lt;/p&gt;
&lt;p&gt;Would be nice to be able to use this as a number in numeric ops and as a key in hash maps. &lt;br&gt;
Also, cljs.core could be extended with functions like &lt;code&gt;bigint&lt;/code&gt; and &lt;code&gt;integer?&lt;/code&gt; from clojure.core.&lt;/p&gt;
&lt;p&gt;BigInts would bring clojurescript one step closer to supporting Ratios.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13676/support-for-js-bigint</guid>
<pubDate>Fri, 09 Feb 2024 13:32:21 +0000</pubDate>
</item>
<item>
<title>`resolve` should support array class symbols?</title>
<link>https://ask.clojure.org/index.php/13674/resolve-should-support-array-class-symbols</link>
<description>&lt;p&gt;Clojure 1.12.0-alpha6 has introduced array class symbols, but it doesn't seem that &lt;code&gt;resolve&lt;/code&gt; supports them right now:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(resolve 'long**) ;=&amp;gt; nil
(resolve 'String**) ;=&amp;gt; nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It would be nice if &lt;code&gt;resolve&lt;/code&gt; would be aware of array class symbols. Otherwise, it'd require extra work for some sorts of macros and development tools (that use &lt;code&gt;resolve&lt;/code&gt; under the hood) to support them.&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13674/resolve-should-support-array-class-symbols</guid>
<pubDate>Fri, 09 Feb 2024 02:06:42 +0000</pubDate>
</item>
<item>
<title>Dedupe doesn't mention statefullness in docstring</title>
<link>https://ask.clojure.org/index.php/13636/dedupe-doesnt-mention-statefullness-in-docstring</link>
<description>&lt;p&gt;Unlike all other core functions which can return a stateful transducer, &lt;code&gt;dedupe&lt;/code&gt; doesn't mention this in its docstring. E.g. &lt;code&gt;distinct&lt;/code&gt;, &lt;code&gt;drop-while&lt;/code&gt; etc. all say:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Returns a stateful transducer when no collection is provided.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;But &lt;code&gt;dedupe&lt;/code&gt; just says:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Returns a transducer when no collection is provided.&lt;/p&gt;
&lt;/blockquote&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13636/dedupe-doesnt-mention-statefullness-in-docstring</guid>
<pubDate>Mon, 22 Jan 2024 12:22:44 +0000</pubDate>
</item>
<item>
<title>Do you use arity 3 or higher comparisons such as = &lt; &lt;= &gt; &gt;= == in performance sensitive code?</title>
<link>https://ask.clojure.org/index.php/13627/arity-higher-comparisons-such-performance-sensitive-code</link>
<description>&lt;p&gt;For comparisons (&lt;code&gt;= &amp;lt; &amp;lt;= &amp;gt; &amp;gt;= ==&lt;/code&gt;) arity 3 and higher are much slower than doing e.g. &lt;code&gt;(and (&amp;lt; a b) (&amp;lt; b c))&lt;/code&gt;. The arity 3 is in my research rather less common but still used in e.g. Manifold stream.clj [0] or rrb_vector rrbt.clj [1]. Arity 3 is idiomatic in places, where you compare lower and upper bound for a &quot;variable&quot;. However, I don't think arity 4 and higher is used much in practical code. At least I haven't found any interesting instances of such a use.&lt;/p&gt;
&lt;p&gt;An example implementation (based on the one currently in core) could be:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn &amp;lt;'
  &quot;Returns non-nil if nums are in monotonically increasing order,
  otherwise false.&quot;
  {:inline         (fn [x y] `(. clojure.lang.Numbers (lt ~x ~y)))
   :inline-arities #{2}
   :added          &quot;1.0&quot;}
  ([x] true)
  ([x y] (. clojure.lang.Numbers (lt x y)))
  ([x y z] (and (&amp;lt;' x y) (&amp;lt;' y z)))
  ([x y z &amp;amp; more]
   (if (&amp;lt;' x y z)
     (if (next more)
       (recur y z (first more) (next more))
       (&amp;lt;' z (first more)))
     false)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;[0] &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clj-commons/manifold/blob/c3fc69066f3abba0b5ab0f4c2b1c4338bcc61d19/src/manifold/stream.clj#L978&quot;&gt;https://github.com/clj-commons/manifold/blob/c3fc69066f3abba0b5ab0f4c2b1c4338bcc61d19/src/manifold/stream.clj#L978&lt;/a&gt;&lt;br&gt;
[1] &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.rrb-vector/blob/master/src/main/clojure/clojure/core/rrb_vector/rrbt.clj&quot;&gt;https://github.com/clojure/core.rrb-vector/blob/master/src/main/clojure/clojure/core/rrb_vector/rrbt.clj&lt;/a&gt;&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13627/arity-higher-comparisons-such-performance-sensitive-code</guid>
<pubDate>Tue, 16 Jan 2024 22:14:09 +0000</pubDate>
</item>
<item>
<title>Can't know if value in option map is default or user-supplied</title>
<link>https://ask.clojure.org/index.php/13555/cant-know-if-value-in-option-map-is-default-or-user-supplied</link>
<description>&lt;p&gt;I have a program that accepts a number of options at the CLI that I allow to be specified in a config file as well. That way, instead of passing &lt;code&gt;--quiet&lt;/code&gt; to all calls, one can put into &lt;code&gt;.splint.edn&lt;/code&gt; the map &lt;code&gt;{quiet true}&lt;/code&gt; to have it enabled automatically. It is valuable sometimes to override the config file by passing the option at the CLI so when building the options map, I first load the config file and then merge in the CLI options: &lt;code&gt;(merge local-config cli-options)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;However, if I specify a default in the tools.cli spec, I lose that behavior because the defaulted option will unconditionally overwrite the config file when merged as it is always present in the CLI options map.&lt;/p&gt;
&lt;p&gt;I've taken to leaving out the &lt;code&gt;:default&lt;/code&gt; key from my tools.cli specs, opting to just write &lt;code&gt;&quot;Defaults to true.&quot;&lt;/code&gt; in the option description string. For example, &lt;code&gt;[nil &quot;--[no-]parallel&quot; &quot;Run splint in parallel. Defaults to true.&quot;]&lt;/code&gt; and then later &lt;code&gt;(get config :parallel true)&lt;/code&gt; and then later &lt;code&gt;(merge local-config cli-options)&lt;/code&gt;. This means my summary doesn't have the pretty-printed &lt;code&gt;FALSE&lt;/code&gt; in the option. (For example, &lt;code&gt;--[no]-parallel FALSE Run splint in parallel.&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;I've a few ideas about how to solve this little snag for me (beyond &quot;You've already solved it, do nothing!&quot;):&lt;br&gt;
1) return an additional key from &lt;code&gt;cli/parse-opts&lt;/code&gt;, something like &lt;code&gt;:defaults&lt;/code&gt;. It would be a seq or set of the options that used the defaults. That way, I can add some logic like &lt;code&gt;(merge (select-keys cli-options defaults) local-config (apply dissoc cli-options defaults))&lt;/code&gt;.&lt;br&gt;
2) Add a &lt;code&gt;:default-display&lt;/code&gt; to the &lt;code&gt;cli/parse-opts&lt;/code&gt; specs, which will print the default without adding it to the options map. It would be on the user (dev) to ensure it's actually added to the options map or used in some way.&lt;br&gt;
3) Add some functionality that allows for specifying a default in the summary but puts something else in the map. For example, &lt;code&gt;--[no]-parallel FALSE&lt;/code&gt; but the map gets &lt;code&gt;{:parallel :false}&lt;/code&gt;. This would let me choose the right value as appropriate.&lt;/p&gt;
&lt;p&gt;Thanks so much!&lt;/p&gt;
</description>
<category>tools.cli</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13555/cant-know-if-value-in-option-map-is-default-or-user-supplied</guid>
<pubDate>Wed, 13 Dec 2023 14:28:17 +0000</pubDate>
</item>
<item>
<title>data.xml : disable support-dtd by default</title>
<link>https://ask.clojure.org/index.php/13523/data-xml-disable-support-dtd-by-default</link>
<description>&lt;p&gt;As defined by OWASP recommendations [1], both &lt;code&gt;supporting-external-entities&lt;/code&gt; and &lt;code&gt;support-dtd&lt;/code&gt; should be disabled by default.&lt;br&gt;
While it's the case for the former (but not released as part of the 0.0.8 version), it's not the case for the latter.&lt;/p&gt;
&lt;p&gt;Can we consider having both defined to &lt;code&gt;false&lt;/code&gt; as part of a stable version?&lt;/p&gt;
&lt;p&gt;[1] : &lt;a rel=&quot;nofollow&quot; href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#xmlinputfactory-a-stax-parser&quot;&gt;https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#xmlinputfactory-a-stax-parser&lt;/a&gt;.&lt;/p&gt;
</description>
<category>data.xml</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13523/data-xml-disable-support-dtd-by-default</guid>
<pubDate>Mon, 04 Dec 2023 19:14:34 +0000</pubDate>
</item>
<item>
<title>Add support for context logging in tools.logging</title>
<link>https://ask.clojure.org/index.php/13491/add-support-for-context-logging-in-tools-logging</link>
<description>&lt;p&gt;Structured logging beats plain text.&lt;br&gt;
Context logging + structured logging is a net win. At my workplace we could dump our ad-hoc logging solution which besides support for context logging is inferior to tools.logging, and will make a strong addition to the library's capabilities.&lt;br&gt;
To add support for context logging, we'll probably need an additional protocol for the frameworks which implement such APIs (like SLF4J).&lt;br&gt;
Not sure if it's required, but an additional logging function might also simplify the implementation.&lt;br&gt;
Suggested usage:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(log/info-c {:foo &quot;bar&quot;} my-error &quot;some message&quot;)
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13491/add-support-for-context-logging-in-tools-logging</guid>
<pubDate>Sun, 26 Nov 2023 16:21:19 +0000</pubDate>
</item>
<item>
<title>Is tools.build considering adding a :license argument?</title>
<link>https://ask.clojure.org/index.php/13341/is-tools-build-considering-adding-a-license-argument</link>
<description>&lt;p&gt;Now that Clojars requires licenses, projects that need to go up there need a license block in the pom files of their jars. Using build.tools it's possible to create a pom.xml, manually edit it to include a license section, then create a jar using that pom. But, that's manual.&lt;/p&gt;
&lt;p&gt;Are there plans to add an option for &lt;code&gt;write-pom&lt;/code&gt; (and &lt;code&gt;gen-pom&lt;/code&gt;) to allow programmatic insertion of a license?&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13341/is-tools-build-considering-adding-a-license-argument</guid>
<pubDate>Fri, 29 Sep 2023 17:17:01 +0000</pubDate>
</item>
<item>
<title>Why doesn't clojure.set provide a &quot;symmetric difference&quot; function?</title>
<link>https://ask.clojure.org/index.php/13324/why-doesnt-clojure-provide-symmetric-difference-function</link>
<description>&lt;p&gt;Is there a particular reason why clojure.set does not provide a &lt;code&gt;symmetric-difference&lt;/code&gt; function?&lt;/p&gt;
&lt;p&gt;It seems a relatively frequent thing to want.&lt;/p&gt;
</description>
<category>Collections</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13324/why-doesnt-clojure-provide-symmetric-difference-function</guid>
<pubDate>Mon, 25 Sep 2023 20:44:24 +0000</pubDate>
</item>
<item>
<title>Support of Maven Password Encryption in tools.deps</title>
<link>https://ask.clojure.org/index.php/13320/support-of-maven-password-encryption-in-tools-deps</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;When I try to use &lt;a rel=&quot;nofollow&quot; href=&quot;https://maven.apache.org/guides/mini/guide-encryption.html&quot;&gt;Maven Password Encryption&lt;/a&gt;, dependency resolution fails with 401 HTTP error code because &lt;strong&gt;tools.deps&lt;/strong&gt; sends encrypted password from &lt;strong&gt;settings.xml&lt;/strong&gt; without decryption. I used the following scenario:&lt;br&gt;
1. Create &lt;strong&gt;settings.xml&lt;/strong&gt; and &lt;strong&gt;settings-security.xml&lt;/strong&gt; with encrypted master and server passwords according to the Maven guide.&lt;br&gt;
2. Add the repository from &lt;strong&gt;settings.xml&lt;/strong&gt; to &lt;strong&gt;deps.edn&lt;/strong&gt; according to &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/deps_and_cli#_maven_authenticated_repos&quot;&gt;Maven authenticated repos&lt;/a&gt; guide&lt;br&gt;
3. Ensure that &lt;strong&gt;~/.m2/repository&lt;/strong&gt; doesn't have some Maven dependency from &lt;strong&gt;deps.edn&lt;/strong&gt;&lt;br&gt;
4. Create &lt;strong&gt;pom.xml&lt;/strong&gt; with the same list of dependencies as those that are in &lt;strong&gt;deps.edn&lt;/strong&gt;&lt;br&gt;
5. Run &lt;strong&gt;clj -X:deps tree&lt;/strong&gt;. The command fails with 401 HTTP error code&lt;br&gt;
6. Run &lt;strong&gt;mvn dependency:tree&lt;/strong&gt;. The command resolves and downloads all dependencies&lt;br&gt;
7. Remove some dependencies from &lt;strong&gt;~/.m2/repository&lt;/strong&gt;&lt;br&gt;
8. In &lt;strong&gt;settings.xml&lt;/strong&gt; replace encoded server password by plain text server password&lt;br&gt;
9. Run &lt;strong&gt;clj -X:deps tree&lt;/strong&gt;. The command resolves and downloads all dependencies&lt;/p&gt;
&lt;p&gt;I've looked to sources of &lt;strong&gt;tools.deps&lt;/strong&gt; and it looks like there is no support of such passwords, but it can be the case that I was looking in wrong places.&lt;/p&gt;
&lt;p&gt;Could you please help me to understand - am I using incorrect configuration in &lt;strong&gt;deps.edn&lt;/strong&gt;, or &lt;strong&gt;tools.deps&lt;/strong&gt; doesn't support encrypted Maven passwords?&lt;/p&gt;
</description>
<category>tools.deps</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13320/support-of-maven-password-encryption-in-tools-deps</guid>
<pubDate>Mon, 25 Sep 2023 12:09:30 +0000</pubDate>
</item>
<item>
<title>Missing stateful string accumulator function (for transduce target)</title>
<link>https://ask.clojure.org/index.php/13294/missing-stateful-string-accumulator-function-transduce-target</link>
<description>&lt;p&gt;If you have a transducer chain that makes a stream of strings, you might want to accumulate them at the end into a string. Existing functions like &lt;code&gt;str&lt;/code&gt; will generate a lot of overhead as there is no stateful accumulator you can maintain.&lt;/p&gt;
&lt;p&gt;What you really want is a StringBuilder that accumulates, and emits the string at finalization.&lt;/p&gt;
&lt;p&gt;String joining could then be something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(transduce (interpose &quot;,&quot;) str! coll)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;extensible with more transducers as needed.&lt;/p&gt;
&lt;p&gt;cgrand's xforms lib has something like this: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/cgrand/xforms/blob/2079b74271b858b6a91dcb87bc58f3b93ea0b19c/src/net/cgrand/xforms/rfs.cljc#L145-L147&quot;&gt;https://github.com/cgrand/xforms/blob/2079b74271b858b6a91dcb87bc58f3b93ea0b19c/src/net/cgrand/xforms/rfs.cljc#L145-L147&lt;/a&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13294/missing-stateful-string-accumulator-function-transduce-target</guid>
<pubDate>Fri, 15 Sep 2023 19:04:56 +0000</pubDate>
</item>
</channel>
</rss>