Fork me on GitHub
#chlorine-clover
<
2020-11-27
>
sparkofreason22:11:34

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.szabo22:11:50

I believe it's missing a ) here

sparkofreason22:11:35

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

seancorfield22:11:22

Which Paredit extension are you using in VS Code @U066LQXPZ?

seancorfield22:11:23

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

sparkofreason22:11:00

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.

sparkofreason16:11:45

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.szabo22:11:37

(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.szabo22:11:45

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
lread22:11:03

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

sparkofreason22:11:37

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

lread22:11:30

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

sparkofreason22:11:17

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

mauricio.szabo22:11:24

@U066LQXPZ is this experiment public, private?

sparkofreason22:11:26

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

sparkofreason22:11:39

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.

lread22:11:29

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

mauricio.szabo15:11:32

@U066LQXPZ 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

sparkofreason16:11:53

@U3Y18N0UC 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?

borkdude16:11:49

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

sparkofreason16:11:23

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

borkdude16:11:06

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

borkdude16:11:33

and not print all of the fields

sparkofreason16:11:02

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

lread16:11:22

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

sparkofreason16:11:40

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.

lread16:11:08

ah, I see.

mauricio.szabo17:11:50

@U066LQXPZ 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

sparkofreason17:11:09

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

borkdude17:11:10

@U3Y18N0UC so you are effectively using a prepl?

mauricio.szabo17:11:49

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.szabo17:11:53

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

borkdude17:11:14

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.szabo17:11:16

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.szabo17:11:23

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.szabo17:11:54

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

mauricio.szabo17:11:52

@U04V15CAJ 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

borkdude17:11:45

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.szabo17:11:47

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)