This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-28
Channels
- # announcements (1)
- # beginners (43)
- # calva (7)
- # clojure (48)
- # clojure-europe (19)
- # clojure-nl (1)
- # clojure-norway (24)
- # clojure-uk (4)
- # clojuredesign-podcast (4)
- # clojurescript (11)
- # conjure (15)
- # core-async (1)
- # cursive (1)
- # datomic (33)
- # events (1)
- # fulcro (2)
- # humbleui (21)
- # hyperfiddle (34)
- # introduce-yourself (1)
- # joyride (24)
- # lambdaisland (8)
- # lsp (3)
- # malli (30)
- # meander (2)
- # observability (5)
- # off-topic (2)
- # pathom (3)
- # polylith (26)
- # portal (5)
- # re-frame (28)
- # shadow-cljs (7)
- # spacemacs (2)
- # xtdb (6)
I'm unsure whether this thread is channel-appropriate, but we have an interesting philosophical thread at #C06JQJN3F4Z this morning. Perhaps someone here might be interested in this topic as well.
Hey, I'm trying out cljfx for first time. I'm using macbook air M2. Java details
openjdk 21.0.2 2024-01-16
OpenJDK Runtime Environment Homebrew (build 21.0.2)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.2, mixed mode, sharing)
I used examples/e12_interactive_development.clj
I ran repl using clj -M:examples
When I run (fx/mount-renderer *state renderer)
i'm getting exception - https://pastebin.com/jp8RSTEm
user=> 2024-02-28 15:25:39.764 java[8488:170269] *** Assertion failure in -[_NSTrackingAreaAKViewHelper removeTrackingRect:], _NSTrackingAreaAKManager.m:1781
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '0x0 is an invalid NSTrackingRectTag. Common possible reasons for this are: 1. already removed this trackingRectTag, 2. Truncated the NSTrackingRectTag to 32bit at some point.'
Any ideas what is going wrongI think that is caused by a pre 19 version of java-fx, which doesn't work with M2. Try to upgrade java-fx to the latest stable, which I think is 21
add this deps to your project :
org.openjfx/javafx-controls {:mvn/version "21.0.2"}
org.openjfx/javafx-base {:mvn/version "21.0.2"}
org.openjfx/javafx-graphics {:mvn/version "21.0.2"}
org.openjfx/javafx-media {:mvn/version "21.0.2"}
org.openjfx/javafx-web {:mvn/version "21.0.2"}
and see if it solves your issueif that doesn't solve it you can try the latest early access, which is 23-ea+3
in all those deps
Also, it's not entirely obvious to me from the Java details, so just in case - there are two JDK variants that can be run on M2. One is native to M2, the other is not. The latter is slower and causes problems more often.
@U2FRKM4TW oh, I was not aware. Let me see if I can find how to install/use it
Fixing the version and running the example is working when I'm copy pasting code in terminal repl.
But when I run nrepl in terminal use cljfx and connect with emacs cider (whether in cljfx repo or as cljfx lib {latest commit sha} in another project)
I'm getting this error again and it crashes repl
I tried to see which variant I have (based on a SO answer) running file $(brew --prefix openjdk)/bin/java
gives /opt/homebrew/opt/openjdk/bin/java: Mach-O 64-bit executable arm64
I'm getting a feeling that it is related to macos and java (maybe clojure) setup more than cljfx specific issue
hm, I think this is a known issue (https://github.com/cljfx/cljfx/issues/177), though Iām not sure whatās causing it
it might be that emacs is running in rosetta emulation mode (i.e. x86, not arm), and that maybe causes emacs to pick up x86 jdk if both x86 and arm are installedā¦
maybe you could try launching jdk using nrepl and evaluating (System/getProperty "os.arch")
?
@U47G49KHQ I didn't fully understand launching jdk using nrepl
. I opened terminal and typed clj
and evaluated (System/getProperty "os.arch")
.The result is aarch64
on jdk 21, it should automatically select javafx version 22-ea+16
which should work on m2
@U47G49KHQ I'm using latest git commit (from project readme) - cljfx/cljfx {:sha "60bb2dd6ca3331959600e67ad9eb401f7b09d83e", For cljx repo (examples tutorials). I've updated all javafx-* libs to 21.0.2 as suggested before
you mean like copy pasting from cljxfx deps to my project's deps.edn so that it will override cljfx's java-fx lib versions?
should I use 22-ea+16
org.openjfx/javafx-controls {:mvn/version "21.0.2"}
org.openjfx/javafx-base {:mvn/version "21.0.2"}
org.openjfx/javafx-graphics {:mvn/version "21.0.2"}
org.openjfx/javafx-media {:mvn/version "21.0.2"}
org.openjfx/javafx-web {:mvn/version "21.0.2"}
22-ea+16 is latest, and has some fixes for issues that you might not even hit, depending on what you want to do. It has some improvements for keyboard shortcut handling on non-US keyboard layouts
maven central shows 23-ea+3
as the latest, which is weird, not sure why there are early access to 23 but no 22 stable
@U47G49KHQ It worked š:skin-tone-3: Thanks a lot! I'm trying out cljfx for my desktop product. This is my first time taking a jab at it. I'm little concerned out the distribution process for java/clojure/cljfx stack. Will user need java to be installed or deal with any other steps except download and install? Majority of users will be non technical people My other candidates were electron (I'm a web dev) and most electron based desktop app I personally use have straight forward way for all platforms (exe, dmg, appimage etc). And I've https://github.com/logseq/logseq for reference to setup it up Is there any tips you can provide? A prod ready project will be perfect for pipeline setup if it available online
What do you think about https://aphyr.com/posts/367-why-is-jepsen-written-in-clojure, especially the drawbacks he mentions? My summary of his list of drawbacks here: ---- ā¢ small engineering community AND no (broadly-accepted, successful) static typing system ā¦ Both of these would constrain a large team, but Jepsenās maintained and used by only 1-3 people at a time. ā¢ Working with JVM primitives can be frustrating without dropping to Java; I do this on occasion. ā¢ Some aspects of the polymorphism system are lacking, but these can be worked around with libraries. ā¢ The error messages are terrible. I have no apologetics for this.
> small engineering community I'm not sure about this, if it is about hiring, there seems to be always people looking for Clojure jobs, and if it is about finding help and support, I think there is plenty > no (broadly-accepted, successful) static typing system I don't think this is a drawback for every system. It is not clear from the article what aspects of the lack of static typing he is missing, and why spec or malli can't cover those > Some aspects of the polymorphism system are lacking by reading the comments he talks about lack of inheritance there, and if I have to choose between having to repeat some code vs reasoning about inheritance calls I choose the former > The error messages are terrible this is super generic, and imho it applies much more to beginners than to experienced Clojurists. The clojure compiler is form based instead of file based, which makes things worse. I think there is room for improvement here but imho the way to improve this is on a case by case.
>> small engineering community > ...if it is about finding help and support, I think there is plenty It's not a showstopper for me but I do notice the drawbacks of having fewer people working on things.
> I do notice the drawbacks of having fewer people working on things interesting, you mean the speed in which the ecosystem evolves?
> The error messages are terrible This one has been near the top of the list every year since the core team started doing the surveys lol. In my opinion, having used a number of other languages that provide significantly better error messages, I find this to be the hardest part of continuing to work in Clojure. I pretty frequently find myself in situations where I have a mismatch of expectations and the resulting error messages provide little to no help. I end up doing a painstaking close reading of the stack trace to figure out exactly what went wrong and why, performing the work that other compilers perform automatically. I don't think it all comes down to "dynamic types" either. Python has put a lot of work into their error messages, and they're able to point out exactly what went wrong with clear and helpful wording. "But what about Clojure 1.10's error messages?" I think they're a good step up, but they're still quite opaque and cumbersome. I wrote a bunch of reddit comments about this back in 2022 (https://old.reddit.com/r/Clojure/comments/x6x9gu/what_is_most_in_need_in_clojure_opensource/inbi192/, https://old.reddit.com/r/Clojure/comments/x6x9gu/what_is_most_in_need_in_clojure_opensource/inbvgmq/, https://old.reddit.com/r/Clojure/comments/x6x9gu/what_is_most_in_need_in_clojure_opensource/inbzdpx/) , but in short, there's no fundamental philosophy about what an error message should be or how it should work in Clojure. Some of them are pretty clear ("Unmatched delimiter"), some are complex and hard to parse and understand ("Syntax error macroexpanding clojure.core/defn"), some are completely impenetrable ("class java.lang.Long cannot be cast to class java.util.concurrent.Future").
yeah, about the macro expansion errors it would be great if the most used macros like defn
, let
, etc gave error messages like this instead :
I guess I could experiment with that in ClojureStorm
My thoughts (though aphyr has way more experience with Clojure than me): > small engineering community AND no (broadly-accepted, successful) static typing system I think the benefits of static typing are clear, but there are downsides, too. So it isn't obvious yet that that it would be a net win. > Both of these would constrain a large team, but Jepsenās maintained and used by only 1-3 people at a time. What if yes, it would constrain a large team, but it also enables a small team to do a lot?
Yea I was wondering about that too, but wasn't sure if they had to do something special to accomplish that
Yeah, Iām not familiar, but I doubt it involves grafting on a static type system onto Clojure. More likely specs and schemas, if indeed they use something of the sort.
they use a lot of schemas, and as i remember it, they don't run traditional microservices, but they do something similar to polylith where there are defined entrypoints to every service that are checked by those schemas
I doubt they are as affected by the potential āsmall communityā issue as well, given the rather large engineering force they employ. They can theoretically make in-house what theyāre missing.
I think the removing the 'small community' argument was also the point of building on the JVM. So there is a bridge between the small community to a massive one. But it doesn't invalidate the argument completely, just mitigates it.
Purely from my own experiences it does seem that projects using static typing languages tend to have a lot of people working on them. Fewer people seem to be required for a Clojure project to get the same results in the same timeframe (or less). I believe this is one of the benefits that was said about lisp dialects back in the 1980s. As the language syntax is simpler and has less boilerplate code, then more time can be spent understanding the problem and finding the appropriate solution than wrangling with the language syntax (or looking up the 50+ precedence rules for the language) I also see a small community as a positive thing. There is less division and fewer frameworks to pick through, is much more stable and you don't feel you have to rebuild your stack or tooling every 6 months.
Fixing the version and running the example is working when I'm copy pasting code in terminal repl.
But when I run nrepl in terminal use cljfx and connect with emacs cider (whether in cljfx repo or as cljfx lib {latest commit sha} in another project)
I'm getting this error again and it crashes repl
I tried to see which variant I have (based on a SO answer) running file $(brew --prefix openjdk)/bin/java
gives /opt/homebrew/opt/openjdk/bin/java: Mach-O 64-bit executable arm64