clr

bobcalco 2023-06-21T13:32:09.743629Z

@dmiller I know (and understand why) there is little mercy among mainline clojurians for Windoze users, but those of us (also) working on the CLR usually cannot avoid it. I have run into one annoyance doing the WSL thing (which is surprisingly cool, I might add--Linux is now officially my favorite new feature of Windows! lol) that I feel ClojureCLR should "get right" when reading deps.edn files that I'd like to suggest. Namely, when :local/root is referred to in a deps.edn file, it would be helpful to automatically translate file paths. The runtime can know it's on Windows Linux and therefore should look for the following cases: 1) a path starts with "C:/" but we're running WSL, so automatically convert it to "/mnt/c/", and 2) vice versa, we're running windows but encounter "/mnt/c/" in which case it should convert automatically to "C:/" (where C here can be any drive letter in both cases). I don't mean deps.edn itself should be modified, just that it automatically translates those file paths. I have run into this on my current mainline JVM work, and I need to keep modifying my deps.edn depending on whether I'm in a WSL shell or PowerShell running the Linux JVM or the Windoze one. In terms of knowing you're on WSL, I can say that for the JVM version, (System/getProperty "os.version") contains/ends with "microsoft-standard-WSL2". I haven't yet looked at what the CLR result is for the same property, but I assume the answer will contains similar clues. It would be nice if this was also patched for mainline JVM, but CLR should definitely consider dev/testing ergonomics on Windows/WSL.

bobcalco 2023-07-08T12:59:21.552359Z

I can't believe it took me this long, but I finally got around to logging the question @alexmiller @dmiller : https://ask.clojure.org/index.php/13072/feature-request-clojure-specify-conditional-values-local

Alex Miller (Clojure team) 2023-06-21T13:41:27.298009Z

seems like a good consideration for tools.deps if you want to make a jira in TDEPS or a question on http://ask.clojure.org

bobcalco 2023-06-21T13:45:22.971339Z

@alexmiller OK. The issue may be of wider interest than just Windows running Linux. I know that when running Parallels on Mac there is similar "integration" between the file systems. So perhaps this can be framed as a more general problem, one that devs today are pretty likely to run into.

bobcalco 2023-06-21T13:46:25.712499Z

At least, I ran into it. FWIW. lol.

Alex Miller (Clojure team) 2023-06-21T13:49:22.834969Z

certainly the code in tools.deps is deferring to the jdk as much as possible for path and classpath joining, splitting, etc so that it is os agnostic in that regard. it would be helpful to have specific cases with detail where something is breaking down

bobcalco 2023-06-21T14:09:13.855449Z

OK I'll think this through a bit more carefully when I have a chance. It's a general interop problem which means solutions can be brittle (subject to changing conventions and combinatorial explosion of possible heuristics), and brittle solutions really aren't solutions. For example, I need to find out if "/mnt/x/" where x is the drive letter is common to all WSL distros. If not that could be a show stopper unless there is a sensible rule at play at some level.

bobcalco 2023-06-21T14:10:11.480369Z

If not, then it may be a matter of letting the user provide the logic for translation somehow via configuration (another parameter to deps.tools when reading an edn file for example)

Alex Miller (Clojure team) 2023-06-21T14:10:25.811549Z

I really want concrete things that don't work and then we can work out from there

Alex Miller (Clojure team) 2023-06-21T14:11:07.244599Z

conditional code in Windows or even in WSL is something I'm willing to consider but a lot more clarity about the symptoms and examples is needed

bobcalco 2023-06-21T14:11:12.601519Z

OK. I'll at least put the problem up at http://ask.clojure.org to see if anyone has run into it and found a solution. Then you can take it from there.

bobcalco 2023-06-21T14:11:39.913729Z

And I will try other distros, and see if I can also replicate on my Mac/Parallels setup.

bobcalco 2023-06-21T14:15:17.551749Z

I am probably an oddball in working in so many divergent runtimes/os's, but the stuff I'm working on needs to work interchangeably wherever Clojure can run. Clojure's reach is one of the major non-language-specific reasons I love it.

bobcalco 2023-06-21T14:26:58.106559Z

OK, not to try to solve the problem before it's been fully elucidated ... (and now comes the part where I do precisely that)...it might be enough to add a case for :local/root where instead of a string it takes a hash, with possible keys for :os/windows, :os/linux and :os/mac such that it uses whatever the user provides for those cases. It's easy to imagine this solving my problem in any concrete combination. It would eliminate the editing when you need to switch OSs on the local machine, and minimize it as you change your setup. Using local paths is inherently ... local. 🙂 I'll suggest this for consideration in my write up.

Alex Miller (Clojure team) 2023-06-21T15:00:41.314299Z

sounds ... bad :)

bobcalco 2023-06-21T16:34:11.830289Z

lol, well - like I said - I'll log it and you guys can figure out how to make a good solution 🙂

bobcalco 2023-06-21T16:36:05.855839Z

Auto translating of paths feels - wrought with variables and heuristic pot holes. At least with my suggestion we recognize it's on the dev to point to the right place relative to their local setup on the various "machines" (virtual, emulated, and otherwise). 🙂

bobcalco 2023-06-21T16:36:30.480999Z

But there are probably other ways to skin this particular cat that aren't obvious yet.

Alex Miller (Clojure team) 2023-06-21T16:40:17.094049Z

when I see all the cats, I will decide :)

bobcalco 2023-06-21T16:46:51.942269Z

👍

dmiller 2023-06-22T02:18:36.337809Z

I'll keep an eye out as I work on clr.tools.deps, but also will look forward to whatever the Clojure team comes up. (no cats being harmed in the process)

bobcalco 2023-06-21T13:34:53.372549Z

I should clarify that the Linux I'm running is Ubuntu 22. It may be different for other distros. But at least that one should work. lol. I know, I know. The risk of combinatorial explosion here is real. But still. This file path translation thing is really annoying.