This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-24
Channels
- # ai (41)
- # announcements (4)
- # babashka (14)
- # beginners (24)
- # calva (7)
- # clj-kondo (36)
- # cljsrn (4)
- # clojure (68)
- # clojure-austin (2)
- # clojure-europe (39)
- # clojure-nl (2)
- # clojure-norway (37)
- # clojure-uk (2)
- # clojurescript (7)
- # clr (8)
- # community-development (16)
- # core-async (7)
- # datalevin (67)
- # fulcro (11)
- # helix (1)
- # honeysql (2)
- # london-clojurians (2)
- # off-topic (60)
- # pedestal (3)
- # portal (2)
- # practicalli (1)
- # re-frame (7)
- # reitit (49)
- # releases (3)
- # shadow-cljs (2)
- # xtdb (16)
I have a few potentially dumb and naive questions: For ClojureCLR, is the Clojure code compiled to Common Intermediary Language (CIL/IL) and then executed Just-In-Time (JIT) on the Common Language Runtime, or is ClojureCLR a reimplementation of the CLR itself (the actual VM)? As far as I understand, the CLR is one component of the .NET Runtime, which includes other components, such as the .NET Framework class library and Base Class Library (BCL). How does ClojureCLR relate to the .NET in the broader sense? Is it "a .NET language" like C#, F#, and VB? How does ClojureCLR relate to the .NET Standard (specification) and .NET (implementation)?
Clojure code is compiled to MSIL and then executed. The JITter does its work. Reimplementing the CLR is way above our pay grade. If you are running ClojureCLR under Framework 4.x, the possibility exists to compile Clojure namespaces into DLLs. These will load faster than source. That possibility does not exists under .NET Core 3.1 or .Net 5.0 and above because of functionality that was removed in those versions. There are two senses of being "a .NET language". Your question points to one sense, the ability to interact with class libraries and the like similar to C# et al. The answer here is yes. Interop with BCL and other libraries is fairly easy. For ClojureCLR, it is similar to Clojure interacting with Java, so documents on Java interop will give the flavor. There are some additional complications with the CLR -- generic types, by-ref parameters, and other elements of the CLR not in the JVM. . Some documentation on this is in the ClojureCLR wiki in the github repo. Of particular relevance are https://github.com/clojure/clojure-clr/wiki/Basic-CLR-interop https://github.com/clojure/clojure-clr/wiki/Specifying-types https://github.com/clojure/clojure-clr/wiki/Loading-assemblies https://github.com/clojure/clojure-clr/wiki/ByRef-and-params https://github.com/clojure/clojure-clr/wiki/Calling-generic-methods https://github.com/clojure/clojure-clr/wiki/Defining-types If you run into issues (or just have further questions), this channel is the best place to get them answered. The other sense of being "a .NET language" perhaps implicit in your reference to C#, F# and VB, is the relationship to Microsoft, given that the languages you mention are all "official". ClojureCLR is definitely not in that camp. I'm not quite sure what your third question is aiming at. If it is a question of what platforms ClojureCLR runs on, here goes: If you are using Clojure by calling it from C# (not my first choice), there is a DLL that has all the Clojure code. https://www.nuget.org/packages/Clojure/ That is configured for Framework 4.6.2 and later and under .NET Standard 2.1, and so will run under .NET Core 3.1, and .Net 6.0 and 7.0 (should work under 8.0 but I haven't tested it.) more likely you will start by running a REPL. In this case, follow the instructions here: https://github.com/clojure/clojure-clr/wiki/Getting-started There is one mechanism recommended for .Net Core 3.1, .Net 6.0, etc. -- to install it as a tool. There is a different mechanism for .Net Framework. Sorry. https://github.com/clojure/clojure-clr/wiki/Getting-started
Awesome, thank you for taking the time to answer that my questions, @dmiller! I'm currently working for a company heavily invested in Microsoft and C# .NET, after recently being transferred to a different role/department. And I'm thinking of doing a presentation of ClojureCLR at some point. As I'm also inexperienced with Clojure, and new to C# .NET, I need to work through some things first. Your answers made some things "click."
I'm happy to answer more questions as they arise. Current work is focusing on making the 'getting started' experience easier.
Great timing, then! I can test the "getting started experience" and maybe even contribute if you want pull requests for that 🙂
By the way, I showed it to some of my co-workers earlier today, and their immediate reaction was that "it didn't look production ready" based on the info in the Git repo. A bit unfair and premature judgement in my opinion. I think they have become accustomed to seeing flashy websites for programming languages and frameworks. Perhaps it would be a good idea to create a website for ClojureCLR with a nice "landing page," similar to the one for Clojure and ClojureScript. But I totally understand that it requires a lot of time and effort to create that kind of "marketing content."