clj-on-windows

For those interested in making clj on Windows https://dev.clojure.org/jira/browse/TDEPS-67. Also see https://github.com/littleli/scoop-clojure.
carkh 2019-07-02T00:34:44.263600Z

is out already ?

carkh 2019-07-02T00:35:30.264200Z

afaik the increased IO performances will make it more usable

carkh 2019-07-02T00:36:23.264600Z

hum only available through insider program yet

carkh 2019-07-02T00:40:43.266400Z

to answer your question, i dabbled a little bit with it and clojure, it works, notably the cli is fine there. But it's an island within windows. Microsoft advises against going inside the linux file system with windows applications (although the opposite is fine i think)

carkh 2019-07-02T00:41:32.267300Z

That coupled with the lack of UI makes it somewhat problematic to run a proper editor

carkh 2019-07-02T00:42:13.268100Z

Although i was able to install a server and have a GUI emacs running

carkh 2019-07-02T00:42:22.268300Z

under WSL i mean

carkh 2019-07-02T00:44:46.269100Z

running emacs from the console worked almost fine, but some bug with the cursor display makes it almost unusable (that could be on my machine only)

carkh 2019-07-02T00:45:11.269500Z

all in all the feeling was "not quite there yet"

carkh 2019-07-02T00:47:23.269800Z

so we'll see how it goes with WSL 2

carkh 2019-07-02T00:50:28.270300Z

i was using xfc4 with x-ming, that works but eventually crashed

carkh 2019-07-02T00:50:40.270500Z

fonts are all blurry =)

seancorfield 2019-07-02T01:08:18.272400Z

@sogaiu I use Atom/Chlorine on Windows with Clojure CLI running on WSL (the old one) with a Socket REPL and that all works fine -- because Chlorine has code in its "load file" command to detect that crossing of filesystems and it automatically rewrites Windows paths (with a drive ID and \) to WSL paths (with /mnt/<id> and / in them).

seancorfield 2019-07-02T01:09:36.273100Z

Now I run Clojure CLI via Powershell instead, so I can get REBL running (and I no longer have to worry about the cross-filesystem stuff).

seancorfield 2019-07-02T01:09:46.273300Z

^ @carkh

carkh 2019-07-02T01:11:06.273900Z

@seancorfield right, but then you have a windows program rummaging on the linux file system don't you ?

seancorfield 2019-07-02T01:28:35.274900Z

No, the Windows editor is referencing the files on Windows. WSL is referencing those Windows files as /mnt/c/path/to/file.clj

carkh 2019-07-02T01:28:52.275100Z

ok

seancorfield 2019-07-02T01:29:40.275800Z

But WSL 2 recommends focusing on files within Linux for better performance, whereas WSL 1 recommended keeping them on Windows instead.

seancorfield 2019-07-02T01:30:37.277100Z

I'm stuck on WSL 1 since my Windows laptop runs "Home", not "Pro", so I can't enable virtualization, and my desktop is a Mac that runs Windows Pro via Parallels Desktop but that setup can't run virtualization either!

carkh 2019-07-02T01:31:09.277600Z

do you know if they'll lift their recommendation to not let windows programs go on the linux file system ?

carkh 2019-07-02T01:31:36.278Z

i mean, within the windows file system, where the linux file system is stored

seancorfield 2019-07-02T01:42:00.278600Z

Not quite sure what you're asking. They've done a lot of work to allow interop between Windows and Linux across the WSL boundary.

carkh 2019-07-02T01:42:38.279Z

ohwell =)

seancorfield 2019-07-02T01:43:26.279900Z

I mean, that's kind of one of the big pluses about WSL: being able to launch Windows programs from inside Linux so you can process Linux files with Windows programs, and vice versa.

carkh 2019-07-02T01:45:05.281700Z

right, i can't find the source anymore but i did read you shouldn't go play within the windows file system where the linux stuff is stored... but well, i'll just keep not doing it and thhat's that

seancorfield 2019-07-02T01:45:48.282400Z

At least with WSL 2 being fully virtualized, clj will run much, much faster on it. For me, stuck on WSL 1, I'll stick to the Powershell version of clj.

carkh 2019-07-02T01:46:03.282600Z

yes that's a net positive

seancorfield 2019-07-02T01:46:47.283500Z

Ah, gotcha. Well, the WSL 2 file system is virtualized so I'm not sure how that will work at all (using .vhd files instead of an overlaid file system).

carkh 2019-07-02T01:46:59.283900Z

but you know about your setup, it's all fine for a competent developer, intimate with the clojure ecosystem, but if you stop and think about it, it's a bit convoluted

seancorfield 2019-07-02T01:47:18.284300Z

Running clj on Powershell?

carkh 2019-07-02T01:47:23.284500Z

yes

carkh 2019-07-02T01:47:39.285100Z

that's what needs to be done and no doubts it works

seancorfield 2019-07-02T01:48:08.285700Z

That's the recommended approach for Windows. That's why this channel exists and the porting work has been tested by folks here.

carkh 2019-07-02T01:48:27.286200Z

that's the new recommended approach =)

seancorfield 2019-07-02T01:48:53.286900Z

Seems like it needs a little bit of polish to get it over the finish line, partly due to the permissions stuff being fiddly.

carkh 2019-07-02T01:48:58.287100Z

anyways i need to do this matrix for alex

carkh 2019-07-02T01:49:37.287500Z

so how do you start a shadow-cljs

carkh 2019-07-02T01:50:01.288Z

it just won't work with the current setup and deps.edn

carkh 2019-07-02T01:50:36.288500Z

anyways we'll make it work =)

seancorfield 2019-07-02T02:01:25.288800Z

I don't do any cljs development 🙂

carkh 2019-07-02T02:02:28.289900Z

there is also cider not jacking-in with deps.edn

carkh 2019-07-02T02:02:34.290200Z

i guess other tools too

seancorfield 2019-07-02T02:02:38.290400Z

I don't use CIDER either 🙂

carkh 2019-07-02T02:02:47.290600Z

but it's worth considering

carkh 2019-07-02T02:02:59.291Z

it is (was?) the most used editor

seancorfield 2019-07-02T02:03:37.291500Z

I don't use nREPL either BTW.

carkh 2019-07-02T02:05:01.292200Z

to be honest i'm not entirely sure about all it does

carkh 2019-07-02T02:05:51.292900Z

i'm guessing eval interrupting, formatting of output and a general repl protocol

carkh 2019-07-02T02:06:08.293200Z

and all kind of services for completion and the like

carkh 2019-07-02T02:06:37.293700Z

do you have completion without it ?

carkh 2019-07-02T02:07:38.295100Z

must be some code metadata available through there too

seancorfield 2019-07-02T02:07:41.295300Z

Pretty sure it uses Compliment for completion (same author as CIDER) which is a standalone library that other tooling can use. So I use Compliment in dev for completion.

carkh 2019-07-02T02:07:54.295600Z

oh nice

seancorfield 2019-07-02T02:08:36.296400Z

But I can connect my editor setup to any Clojure process, running anywhere, with zero dependencies -- just by starting a Socket REPL via a JVM option.

carkh 2019-07-02T02:09:22.297700Z

well sure we can all do that, but the experience is not at its peak then (imo)

seancorfield 2019-07-02T02:09:58.298300Z

Chlorine makes it a good experience. That's why I use it.

carkh 2019-07-02T02:10:27.298800Z

i'll have to try it some day, last time i tried atom, there was no chlorine

carkh 2019-07-02T02:10:50.299200Z

might be hard to do without cider once you have it in the fingers

carkh 2019-07-02T02:12:26.300100Z

we were discussing running tests, and i switched to regular clojure for dev following our chat

carkh 2019-07-02T02:13:17.301100Z

and cider makes it so easy to run exactly what i want without having it in scope, work on the actual code, and the last failed test is just a keystroke away

carkh 2019-07-02T02:13:34.301300Z

so thank you for that

carkh 2019-07-02T02:14:55.301700Z

anyways getting a bit early here, thanks for the chat and goodnight

seancorfield 2019-07-02T02:19:12.302300Z

This chat just reminded me that I hadn't updated my Powershell install to the latest CLI version!

seancorfield 2019-07-02T02:20:11.302900Z

Windows cmd running via Parallels on a Mac

2019-07-02T02:20:52.303600Z

@carkh @seancorfield thanks for the comments -- hopefully it won't be long before wsl 2 is generally available to try

seancorfield 2019-07-02T02:21:31.304100Z

And "natively" (Powershell via Parallels on the same Mac)

PS C:\Users\sean\clojure> clj -Sdescribe
{:version "1.10.1.458"
 :config-files ["C:\Users\sean\.clojure\deps.edn" "deps.edn"]
 :install-dir "\\Mac\Home\Documents\WindowsPowerShell\Modules\ClojureTools"
 :config-dir "C:\Users\sean\.clojure"
 :cache-dir "C:\Users\sean\.clojure\.cpcache"
 :force False
...

Markus Gustavsson 2019-07-02T06:53:05.306200Z

Easiest way to get clj to a native feel in Windows currently: 1. Install it in Powershell per official instructions. 2. Create a .bat file in PATH with the following content:

@echo off
powershell -command clj %*

Markus Gustavsson 2019-07-02T06:58:36.309800Z

Some input for the "matrix": I would still prefer a fully native version though. Just a file you download that you can put anywhere you want and just run. That is why I suggested C language for implementation. It is the official native language of the win32 API and the executable could link only against dll files installed in Windows by default. But I guess Go and Rust could also do that and they probably have the same filesystem and networking APIs for all supported platforms so they are probably better choices.

Markus Gustavsson 2019-07-02T07:00:00.310700Z

This means the Go or Rust version could be used for all platforms instead of bash and powershell. Would mean better system integration and less code to maintain.

Markus Gustavsson 2019-07-02T07:00:33.311300Z

But I don't really know Go or Rust so I am just guessing.

2019-07-02T07:45:27.312100Z

@markus.gustavsson244 may be you know this already, but there is an unofficial clj / clojure tool that is written in go: https://github.com/frericksm/clj-windows

Markus Gustavsson 2019-07-02T07:58:25.313500Z

@sogaiu Thanks, I know about it but I would rather use an official tool when one exists.

Markus Gustavsson 2019-07-02T07:59:00.314100Z

But perhaps that one can be used as a base for an official one written in Go?

2019-07-02T08:00:15.315200Z

yes, official would be nice -- but i find it has been more helpful to have that for some use than not. no idea whether it can be used as a base. i presume that is up to cognitect folks.

carkh 2019-07-02T10:52:14.315800Z

@markus.gustavsson244 copied your input

carkh 2019-07-02T10:53:33.316700Z

i think you still pay the "3 competing escaping rules" tax with your batch file, i couldn't make it work for all cases

Markus Gustavsson 2019-07-02T10:54:15.317600Z

I did not try mingw or WSL. Just cmd.exe.

carkh 2019-07-02T10:54:51.318200Z

did you try some advanced command line though ?

Markus Gustavsson 2019-07-02T10:54:56.318400Z

Not really

carkh 2019-07-02T10:55:19.318900Z

it gets pretty hairy real fast with escaped quote

carkh 2019-07-02T10:55:57.319800Z

but that's a solution nobody talked about, just do what your batch file does, but with an exe, maybe via a temp ps1 file

Markus Gustavsson 2019-07-02T10:57:04.321Z

I prefer to put "advanced" stuff, like actual clojure code for example, in a file instead of making huge commandlines. In other words, I like to avoid that type of problem on all platforms because shell scripting always breaks for me...

carkh 2019-07-02T10:57:35.321400Z

i'm with you there, but tool makers really do need those

Markus Gustavsson 2019-07-02T10:58:11.322100Z

Sure. But I guess a native executable would be able to handle that well.

carkh 2019-07-02T10:58:23.322300Z

yes i think so