This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-30
Channels
- # announcements (2)
- # babashka (3)
- # beginners (31)
- # biff (3)
- # calva (40)
- # chlorine-clover (2)
- # clerk (5)
- # clj-kondo (10)
- # clojure (13)
- # clojure-art (1)
- # clojure-denver (16)
- # clojure-europe (44)
- # clojure-nl (1)
- # clojure-norway (27)
- # clojure-sweden (3)
- # clojure-uk (1)
- # clojurescript (49)
- # clr (6)
- # community-development (2)
- # datalevin (10)
- # datomic (63)
- # events (2)
- # fulcro (9)
- # holy-lambda (15)
- # honeysql (8)
- # hoplon (6)
- # hyperfiddle (9)
- # introduce-yourself (1)
- # kaocha (1)
- # london-clojurians (2)
- # matrix (1)
- # nbb (7)
- # off-topic (38)
- # polylith (6)
- # re-frame (4)
- # reagent (2)
- # releases (3)
- # sci (13)
- # scittle (5)
- # shadow-cljs (6)
- # sql (5)
- # tools-deps (4)
- # vim (33)
- # web-security (8)
- # xtdb (2)
Added https://learn.microsoft.com/en-us/aspnet/core/tutorials/min-web-api?view=aspnetcore-7.0&tabs=visual-studio#examine-the-get-endpoints - minimal clojure-clr example to potion. https://github.com/Dangercoder/potion/tree/master/examples/dotnet-api.
I think the new .NET framework and how things are built makes things way more easier to consume from a functional programming language like clojure-clr. No more classes and inheritance is needed.
We need some better interop, the only thing that's "blocking me" from using this in anger is async/await
.
• There's no way to await
a task. Sometimes the frameworks/libraries gives you a task. example: https://github.com/Dangercoder/potion/blob/master/examples/dotnet-api/src/dotnet_api/main.cljr#L69
Imagine this:
C#
app.MapGet("/todoitems", async (TodoDb db) =>
await db.Todos.ToListAsync());
Clojure-CLR (with better interop capabilities)
(.MapGet app "/todoitems", ^:async (fn [^TodoDb db]
(await (-> db
.-Todos
(.ToListAsync)))))
I think the new .NET framework and how things are built makes things way more easier to consume from a functional programming language like clojure-clr. No more classes and inheritance is needed.
We need some better interop, the only thing that's "blocking me" from using this in anger is async/await
.
• There's no way to await
a task. Sometimes the frameworks/libraries gives you a task. example: https://github.com/Dangercoder/potion/blob/master/examples/dotnet-api/src/dotnet_api/main.cljr#L69
Imagine this:
C#
app.MapGet("/todoitems", async (TodoDb db) =>
await db.Todos.ToListAsync());
Clojure-CLR (with better interop capabilities)
(.MapGet app "/todoitems", ^:async (fn [^TodoDb db]
(await (-> db
.-Todos
(.ToListAsync)))))
I'm trying to get it ClojureCLR to work in Linqpad (5 - the .NET Framework version) because I think this could be a really good playground for it. I'm getting this error with the latest Clojure + Spec:
I tried adding this code before the call to the clojure api, since it looked the files are not the folder the clojure code expects, but I get the same error.
string baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
foreach (var nugetRef in Util.CurrentQuery.NuGetReferences) {
foreach (var asmPath in nugetRef.GetAssemblyReferences()) {
var filename = Path.GetFileName(asmPath);
try {
File.Copy(asmPath, Path.Combine(baseDir, filename));
} catch (IOException ex) when (ex.HResult == -2147024816 /* file exists */) {
}
}
}