chlorine-clover

About Chlorine for Atom and Clover for VS Code: https://atom.io/packages/chlorine and https://marketplace.visualstudio.com/items?itemName=mauricioszabo.clover
sparkofreason 2020-11-27T22:00:34.285400Z

I've run into some cases where clover doesn't seem to want to send forms to the REPL. Here's one I can repro reliably. Using @seancorfield's setup, ctrl-;+b (or "Clover: Evaluate current block of code" from the command pallette) does nothing. If I select the code and run "Clover: Evaluate current selection of code" via the command pallette, all I see is a red "Unexpected" in the REPL pane. Nothing shows in the dev tools console. Here's the form:

(-> empty-expr 
    (handle-keypress \@)
    (handle-keypress \])

mauricio.szabo 2020-11-27T22:02:50.285700Z

I believe it's missing a ) here

sparkofreason 2020-11-27T22:03:35.286800Z

Ah. You're right. Paredit keeps doing that to me.

sparkofreason 2020-11-28T16:49:45.294500Z

Actually, I think I found the culprit here. I'm simulating keypresses by sending characters like \( to functions. If I have a form like (foo \(), and I delete the ( after the \, it takes the trailing paren of the form with it, leaving (foo \.

mauricio.szabo 2020-11-27T22:03:37.287Z

(This red message is probably comming from the errors on rewrite-cljs, that I use to parse Clojure code. Probably I'll have to handle it soon-ish 🙂)

mauricio.szabo 2020-11-27T22:04:45.288300Z

As I use parinfer most of the time, these kinds of errors are things I don't usually see, so I believe that's one of the reasons this part of Chlorine/Clover is still very crude...

1
lread 2020-11-27T22:19:03.289700Z

(FWIW I am still working on rewrite-cljc, just recently dipped my toe back in and am currently up to my waist :simple_smile:)

mauricio.szabo 2020-11-28T15:39:32.292400Z

@dave.dixon nice, I was thinking on something similar some time ago. What I'm trying to make it work right now is a way to be able to edit fragments next to each other. It's similar to the idea of "code bubbles". In the future, I want to be able to trace the evaluation of code then render on the text editor which functions (and forms of these functions, if possible) were called

sparkofreason 2020-11-28T16:07:53.292600Z

@mauricio.szabo Yes, I had similar thoughts. First I want to nail down the abstraction of editing the AST directly. Tracing is definitely interesting, I assume you've seen the Flow Storm Debugger. Having that integrated in the editor would be pretty cool. Which leads me to a tangential question (which may have nothing to do with clover...): rewrite_clj(c) overrides the behavior of pr-str, such that output is no longer valid clojure, looks like <token: foo>. That's how it appears in the Flow Storm debugger. But if I use a socket REPL with clover, evaluation results print like #rewrite_cljc.node.token.TokenNode{:value foo, :string-value "foo"}, which is puzzling me since I thought the default REPL behavior was to output via prn, which behaves like pr-str. Do you have any insight how this is happening?

borkdude 2020-11-28T16:14:49.292800Z

I can't imagine that it would be a breaking change to change the <foo> output since it's only for display, not readable

sparkofreason 2020-11-28T16:18:23.293Z

Agreed. I'd still like to understand where the difference originates.

borkdude 2020-11-28T16:23:06.293200Z

My guess would be that the original author wanted a more fancy printing output than defrecords have by default

borkdude 2020-11-28T16:23:33.293400Z

and not print all of the fields

sparkofreason 2020-11-28T16:28:02.293600Z

Right. What has me puzzled is how the socket REPL output is different, since I thought it used prn to send results.

lread 2020-11-28T16:29:22.293800Z

The original author has moved on to other things and is not interested in chats about rewrite-clj. I think @borkdude’s guess is good. I raised an issue to explore for rewrite-cljc https://github.com/lread/rewrite-cljc-playground/issues/64

sparkofreason 2020-11-28T16:42:40.294100Z

My question here isn't really about rewrite-clj, it's why clover manages to get a different result than expected, given that the socket REPL is supposedly using prn.

lread 2020-11-28T16:43:08.294300Z

ah, I see.

mauricio.szabo 2020-11-28T17:07:50.294800Z

@dave.dixon well, I don't really rely on pr-str for most cases. In the case of Clojure, the output comes from the unrepl library that I use in Chlorine

sparkofreason 2020-11-28T17:09:09.295Z

@mauricio.szabo Interesting, thanks, I'll have to dig in more and understand how that's wired up.

borkdude 2020-11-28T17:09:10.295200Z

@mauricio.szabo so you are effectively using a prepl?

mauricio.szabo 2020-11-28T17:09:49.295400Z

In other implementations, I'm wrapping the output and modifying the way I print (so the code can give more insights on how it's done)

mauricio.szabo 2020-11-28T17:10:53.295600Z

@borkdude not really, I'm using UNREPL over a plain socket repl.

borkdude 2020-11-28T17:12:14.295800Z

Ah right. I wrote a pREPL for babashka and nextjournal is now using this, along with it they have unREPL like code around it

mauricio.szabo 2020-11-28T17:13:16.296Z

About flow storm debugger, yes I'm seeing a way to integrate it on Chlorine. Seems line an useful tool to trace data, and the author have a HTML version of the UI (so I believe it'll be easy to translate to Chlorine).

mauricio.szabo 2020-11-28T17:15:23.296200Z

But to be honest, I'm thinking about a way to "loosely integrate" flow debugger - maybe with some additional plug-in that talks to Chlorine / Clover using it's public API. I believe it's useful to have different release cycles for both of these projects.

mauricio.szabo 2020-11-28T17:16:54.296500Z

Also, the author of flow debugger lives really close to me right now, so we can hack things together sometime :D

mauricio.szabo 2020-11-28T17:17:52.296700Z

@borkdude yes, I'm aware they have a prepl implementation (I just didn't know that it came from Babashka), I'm also thinking about using it in place of unrepl

borkdude 2020-11-28T17:18:45.296900Z

no, babashka offers a prepl that integrates with their blob code (based on unREPL), but their other stuff is based on prepl as well afaik (JVM Clojure)

mauricio.szabo 2020-11-28T17:20:47.297100Z

Ah, OK. I'll probably do something similar in the future (but not based on unrepl - the code is waaay too much complicated to work with)

sparkofreason 2020-11-27T22:20:37.290100Z

I'm actually using rewrite-cljc in an experiment to make a better Clojure editor.

lread 2020-11-27T22:21:30.290300Z

Awesome! Ah, I see you recently joined our little #rewrite-clj channel!

sparkofreason 2020-11-27T22:22:17.290500Z

Yes, I'll probably be chiming in there soon...🔔

lread 2020-11-27T22:22:46.290700Z

Sweet!

seancorfield 2020-11-27T22:24:22.290900Z

Which Paredit extension are you using in VS Code @dave.dixon?

mauricio.szabo 2020-11-27T22:24:24.291100Z

@dave.dixon is this experiment public, private?

seancorfield 2020-11-27T22:26:23.291300Z

I switched to Strict Paredit recently and it seems like I get fewer hanging parens with that.

sparkofreason 2020-11-27T22:32:26.291500Z

Public, but just barely started proof of concept (like started today). I'm currently convincing myself that it's possible/desirable to do zipper-based editing of Clojure code based on a stream of keystrokes. All just REPL experiments now. https://github.com/sparkofreason/zipped

sparkofreason 2020-11-27T22:34:00.291800Z

Strict Paredit. I need to find a reproducible case, but it seems like sometimes when a do a paredit-based copy/cut and then paste, I somehow manage to lose a trailing paren. I need to pay more attention at try to catch it earlier.

sparkofreason 2020-11-27T22:36:39.292Z

The idea is to make the AST (via rewrite-cljc, at this point) the core representation, rather than text. Seems like there's a list of possible benefits that arise from there, still needs to be proven though.

lread 2020-11-27T22:50:29.292200Z

Whenever you are ready come and chat in #rewrite-clj, I’ve had many interesting, enlightening and fruitful discussions there with @sogaiu, @borkdude and others!