Fork me on GitHub
#clr
<
2023-04-04
>
dmiller14:04:52

The porting blues: When you are trying to port a library from JVM to CLR, the file you're looking at has 14 regular expressions, and the first example you look at has the variant behavior JVM:

(re-find #"^(--[^ =]+)(?:[ =](.*))?" "--beta")  ; => ["--beta" "--beta" nil]
CLR:
(re-find #"^(--[^ =]+)(?:[ =](.*))?" "--beta")  ; => ["--beta" "--beta" ""]
So there is a test that fails on exactly that third value. And you ask yourself: Do I change the test to succeed with "" instead of nil? Do I test that third item at the point of generation and do a replacement there? Do I look for another line of work? And thinking about the other 13 regular expressions, you contemplate returning to bed. Because you know the rest of the day will have regular expressions of expletives.

😅 6
🙏 2
gratitude 2
Frank Henard14:04:18

> Do I look for another line of work? 😆 Makes me curious though... Are you able to do this as part of your full-time job?

dmiller15:04:11

In the past, not part of my full-time job. This work was always on the side. Now I'm transitioning to semi-retirement. So I have more time to spend on this. A little bit of the ClojureCLR work paid. (And a shout-out to my Github sponsors while we're here.) But mostly the ClojureCLR stuff, ClojureCLR.Next in particular, is still on the side. There's just more 'side' now.

👍 2
Frank Henard15:04:10

Ok, cool. Thanks for what you're doing!

dmiller03:04:29

It turned out okay. Most of the regexes were fine. I now have a working port (at least the test suite passes) of tools.cli.

Frank Henard21:04:13

Was having a conversation in another slack workspace... Anyone ever thought of the pros and cons of implementing Clojure in Haxe (goal of the language is cross-vm, with most of the major ones targeted)?

Frank Henard21:04:04

One possible concern is that Haxe is not widely adopted, and that might make it non an ideal target

dmiller03:04:18

I've not heard any discussion of it, but I don't get out much.

👍 2
bobcalco11:04:56

My opinion is that everywhere a virtual machine is, Clojure should be. Moreover I am of the opinion that some day a virtual machine will exist that was built to be Clojure's natural host, i.e., optimized for its FP and concurrency features. JVM has gotten closer to becoming that VM over the years, and CLR has growing potential as it matures; but really none of them are quite that, yet. BEAM's concurrency model makes it an awkward fit despite otherwise excellent FP design--and it deserves more attention. JS... ugh, don't get me started.

👍 2
💜 2
Frank Henard13:04:44

On this topic, @U033MA9FCKE mentioned this article https://simongray.github.io/essays/spread.html > the different Clojure implementations retain the same level of access to the underlying machine that the languages whose runtimes they leech off (Java, C#, JavaScript) do. > > That makes Clojure powerful. I wonder if the layer of abstraction that Haxe adds on top of the ultimate target VM would only serve to hinder interacting with the host language in that VM

bobcalco01:04:34

The key would be to target HashLink: https://hashlink.haxe.org/

👍 2
Frank Henard14:04:32

@U2M7EC8KU My original motivation to implement Clojure in Haxe (compile to Haxe) is my thought was that it would apparently be cross-platform automatically. Do you not think that's realistic?

Frank Henard14:04:57

Also, thanks for that. I didn't know HashLink existed

Frank Henard14:04:53

I guess maybe it would be a matter of creating a Clojure interpreter in Haxe, and that would be automatically cross platform. Not sure exactly the distinctions

Frank Henard20:04:41

@U2M7EC8KU, I was just rereading your reply > JVM has gotten closer to becoming that VM over the years I wonder if that has anything to do with Brian Goetz liking Clojure: https://youtu.be/GedrGWu16_I

clojure-spin 1