This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
I don't think it is valid
It has to do with how the compiler, and specifically eval handles more complex expressions
for more complex expressions (basically anything but a simple function call) eval wraps them in a no-arg function, compiles it, then invokes the no-arg fn
It works, but by accident, sort of like the static field thing that @U064X3EF3 mentioned in this channel earlier
Part of the reason eval does the wrapping in a no-arg fn is because it gives some place for the compiler to emit the bytecode (a method on the clas for the fn), but outside of eval, in other contexts the compiler has other places to write the bytecode, so the wrapping doesn't happen and it won't work
Outside of the compiler there are a lot of macros that introduce 0-arg fn wrappers where that kind of thing also works, like lazy-seq
I wonder if this is worth fixing
I think this case is easily fixable in a few different ways, the easiest would be a flag for fns like :once
that stops it from establishing a recur point
I would almost say you could just add it to once, I think most usages of once fns in the compiler, or in clojure.core macros, using the recur frame introduced by the once fn is a bug, but I bet someone somewhere is depending on it
You could make an http://ask.clojure.org about it and who knows
i wondered if something like this would work, but the core test suite fails in mysterious (to me) ways:
(defn eval
"Evaluates the form data structure (not text!) and returns the result."
{:added "1.0"
:static true}
[form] (. clojure.lang.Compiler (eval `(let [ret# (do ~form)] ret#))))
i don't have a good enough grasp of the compiler or evaluation system to know why. the error message I tried to run down complained that a call to is
in a deftest
couldn't be resolved.
full stack trace for this specific error, if you care to dive in. not the only error, i should say, just the one i tried to figure out
Wrapping everything in a let means you can't eval "top level" dos anymore, which means everything becomes a single compilation unit, which will break eval on stuff like (do (require '[clojure.string :as s]) (s/trim "foo"))
because the require won't be compiled and executed before the call is compiled, so the compiler won't be able to resolve s/trim to anything
oh that's interesting, thanks for the link
I run clojure in a container in a certain scenario, and this results the link to $HOME/.clojure
invalid inside the container and I get
a cp: not writing through dangling symlink '/home/carsten/.clojure/deps.edn'
I would expect that using -Srepro
would not even "try" to copy the example-deps.edn, as it would be ignored in any case later
I clearly want to tell clojure to completely ignore .clojure
But it seem to try to copy an example edn to it, which would probably be ignored later.
bash -x clojure -Srepro
+ set -e
+ install_dir=/usr/local/lib/clojure
+ version=1.11.1.1435
+ print_classpath=false
+ describe=false
+ verbose=false
+ trace=false
+ force=false
+ repro=false
+ tree=false
+ pom=false
+ help=false
+ prep=false
+ jvm_opts=()
+ repl_aliases=()
+ mode=repl
+ '[' 1 -gt 0 ']'
+ case "$1" in
+ repro=true
+ shift
+ '[' 0 -gt 0 ']'
+ set +e
++ type -p java
+ JAVA_CMD=/opt/java/openjdk/bin/java
+ set -e
+ [[ -z /opt/java/openjdk/bin/java ]]
+ false
+ tools_cp=/usr/local/lib/clojure/libexec/clojure-tools-1.11.1.1435.jar
+ [[ -n '' ]]
+ [[ -n '' ]]
+ config_dir=/home/carsten/.clojure
+ [[ ! -d /home/carsten/.clojure ]]
+ [[ ! -e /home/carsten/.clojure/deps.edn ]]
+ cp /usr/local/lib/clojure/example-deps.edn /home/carsten/.clojure/deps.edn
cp: not writing through dangling symlink '/home/carsten/.clojure/deps.edn'
I can indeed solve it by setting CLJ_CONFIG to a valid directory:
CLJ_CONFIG=/tmp /usr/local/bin/clojure -Srepro
Nevertheless I think when using -Srepro
it should not even try to copy the example file anywhere.
I think maybe that's <https://github.com/clojure/brew-install/blob/5dfbe3e8c4ee36d0e13735af56a450403734e849/src/main/resources/clojure/install/clojure#L288> - I'm speculating that perhaps the approach is "set up the config dir in an idempotent way, even if it's not going to be used". I'd imagine that there are so many options that working through every possible combination for each operation in the bash script gets unwieldy to maintain.
I’m trying to help some colleagues use clj-kondo with intellij and i’m wondering, what’s the recommended approach? I’ve run into trouble so far:
• with clojure-extras, I’m seeing a lot of spurious warnings. for example, in test namespaces that refer deftest
, is
, etc I’m seeing warnings to define those. Even seeing a warning to define ns
• with clojure-lsp, I get an error “cannot run program lein” when clojure-lsp attempts to run lein with-profile +test,+dev classpath
The clojure-lsp issue is https://github.com/clojure-lsp/clojure-lsp-intellij/issues/26, running from terminal intellij will fix the problem, this is a high prior to me but I couldn't find a solution yet (only happens for Macs)
thank you! i’ll look into this more monday
> with clojure-extras, I’m seeing a lot of spurious warnings. try linting with clj-kondo on the command line and see what you get there
> I’m seeing warnings to define those what does that look like? I don't have a clear picture of what might be going wrong there
here's an example of what it looks like. had to modify it, like of course the ns name isn't ...
- but the warning to define ns
is there
@U04V15CAJ I wouldn't worry about this too much? who knows what else I have configured that's resulting in this
but to clarify this is when using the clojure-extras plugin for intellij ce
Have you tried this already? https://clojurians.slack.com/archives/C03S1KBA2/p1705767522806909?thread_ts=1705765320.671299&cid=C03S1KBA2
I don't get those warnings from clj-kondo on the command line
then it's likely not your configuration. is there a way to check if this is coming from #C02UN1B0998?
if the warning doesn't show when using clojure-lsp-intellij so it's not from kondo too
Is it common quote like this: (tap> (list '~'fncall '~f args# '~'=> ~res))
within a syntax-quote? I want to tap into what function was called with what args and what was the result. Can't seem to find a shorter way than '~'
...
So the symbol needs quoting in the output, needs splicing into the output, and needs quoting to avoid being evaluated when the macro definition is compiled, so '~'
Using cljs to render an svg with a few pattern elements in a browser using reagent. It renders as expected in a browser but the goal is to print it to a pdf but only the background layer shows up. Anyone run into an issue like that?
"Triple kill!" :D There's #C03S1L9DN and #C0620C0C8, and the issue has absolutely nothing to do with anything Clojure-related.
Adding some patterns to my project is on the to-do list. If I get to that soon I'll test a PDF and let you know what happens. In the meantime, maybe try to export the SVG and then open and print from Inkscape just to see what happens?
This page has examples of patterns: https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Patterns Printing works for me on Chrome on Linux just fine.
@U02UHTG2YH5 thanks please let me know! Importing it into Inkscape and illustrator for exporting is on my todo list for today
I got that without making any changes. Worked on my end both in Chrome and Firefox.
The only thing that my index.html
has that's beyond bare-bones is <meta name="viewport" content="width=device-width, initial-scale=1">
in its <head>
. No clue how important that is.
Aha! It at least works in Brave and probably chrome. That narrows it down to at least a Firefox specific issue. That at least gives me a lead to follow. Thanks so much!
@U2FRKM4TW by chance are you using Firefox nightly?
Odd just can't get them to display when printing to firefox. Did find some similar issues in Firefox bugs though
Just in case - my version of Firefox is 121.0.1-1. I remember having problems with printing in Firefox too. Only not with SVGs but something with flexbox. Had to come up with some workaround.